has anyone seen this error before with :advanced optimizations enabled?
core.cljs:59 Uncaught Error: No protocol method InitialAppState.initial-state defined for type function: function (){React.Component.apply(this,arguments);this.state=null!=<http://this.ga?this.ga():{};return|this.ga?this.ga():{};return> this}
@jasonjckn: Just curious, are you using any field accessors in you code (like (.-legs Cat)
). That has broken our advanced builds before. @ethangracer can explain in more detail, but it has to do with maps converted to js object.
yes i am @mahinshaw does that include (.-target e)
@jasonjckn: @mahinshaw: set!
and .-
interop only work in advanced compilation when the things are known to GClosure
if you want to access properties in Objects that are treated as maps (vs instances) you need to use goog.object/get
and goog.object/set
what about (.-value (.-target evt))
does gclosure know about that?
that should be OK, yes
is 'static' an om.next thing or cljs thing?
i'm trying to use it for my own purposes
Om Next
you can probably use it for your own purposes
I wrote this macro for syntatic sugar
(defmacro defui [name q & forms]
{:pre [(symbol? name)
(or (map? q) (vector? q) (list? q))]}
`(do
(declare ~(symbol (factory-name (str name))))
(om.next/defui ~(with-meta name {:once true})
~'static cljs.core/IDeref
(~'-deref [this#]
~(symbol (factory-name (str name))))
~'static om.next/IQuery
(~'query [this#]
~q)
~@forms)
(def ~(symbol (factory-name (str name)))
(om.next/factory ~name {:keyfn (let [c# (atom 0)]
#(swap! c# inc))}))))
but statics are elided in advanced compilation
esentially it let's me get the factory function on a defui by using @
so @TabUnion
but it's choking advanced
that's probably why then
@jasonjckn: try (deref (.. MyComponent -prototype))
instead
if your troubles go away, you’ll know it was because of that
k
@anmonteiro: Thanks for filing that in for me.
@jasonjckn: I've been using this macro at work for a while, works fine with advanced compilation https://github.com/currentoor/untangled-starter/blob/master/src/untangled_starter/aum.cljc
lets me use sablono in the body and omit the om.next protocol names
i had been working on something similar, except with the intention to wrap the render method with devtools when in dev mode https://github.com/untangled-web/untangled-client/commit/aa0970c48b1333668c28579c6c444a29e5158b75
i also had a variant that would let you do something like
(defui SomeComp
:query some-query
:render some-fn)
@adambros: cool, i might steal some ideas here
the idea was to have some button that you press, and you entered a mode in which components would highlight on hover, letting you go to their definition, see their query & appstate, etc
hmm that would be cool, my goal with that starter kit was just to make it easy for me to prototype with untangled, defui wrapper and the full React Bootstrap UI kit ready to go
and then some sort of panel open up that would let you query & inspect app state
right, well untangled-template should be coming out soon
i could see a case for an —experimental
option
we could put stuff related to defui wrappers in that
yeah that would be cool
@adambros: i remember tony mentioning something about having a UI kit of components
maybe we could use my react bootstrap wrapper?
as a starting point
what is a react bootstrap wrapper?
do i just need to google it ?
the first section of that readme, this one cljc file basically https://github.com/currentoor/untangled-starter/blob/master/src/untangled_starter/bootstrap.cljc
gives you a clojurescript-y api for all these components https://react-bootstrap.github.io/components.html
i see
unlike many vanilla react components they don't require you to mess around with local state so it's clean to use with cljs
in a real production app it's probably best to roll out your own components from scratch but for prototyping it's nice to have stuff like modals, dropdowns, tooltips, and form elements (with error states) ready to go IMHO
also comes with a grid systems, which is pretty nice
plus customizing bootstrap styles with less/scss variables is pretty easy
does sound nice, we’ll have to see what tony thinks, but this doesn’t have to be part of untangled, and might be better off that way
right yeah i don't think it would make sense to be part of untangled directly, a contributor library perhaps?
volt batteries included untangled
or lotus as a pun off of om
lotus?
strands?
maybe im thinking of a different word
(bits of untangled thread)
untangled-strands
braid?
knot
how about untangled-knots
😞
or knot-untangled
?
sounds like rope
I think knots and braids are what we're trying to avoid!
Lotus:
It represents purity, perfection, and pacification of one's nature. A white lotus symbolizes the pinnacle of achievement in the Buddhism and as such has come to be called the Flower of the Buddhas (though it does not represent the Buddha himself).
because #humblebragxD
jeez lol