untangled

NEW CHANNEL: #fulcro
2016-07-18T18:36:58.000002Z

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}

mahinshaw 2016-07-18T18:48:39.000003Z

@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.

2016-07-18T19:02:55.000005Z

yes i am @mahinshaw does that include (.-target e)

anmonteiro 2016-07-18T19:04:51.000006Z

@jasonjckn: @mahinshaw: set! and .- interop only work in advanced compilation when the things are known to GClosure

anmonteiro 2016-07-18T19:05:40.000007Z

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

2016-07-18T19:06:03.000009Z

what about (.-value (.-target evt))

2016-07-18T19:06:09.000010Z

does gclosure know about that?

anmonteiro 2016-07-18T19:06:24.000012Z

that should be OK, yes

2016-07-18T19:06:46.000013Z

is 'static' an om.next thing or cljs thing?

2016-07-18T19:06:52.000014Z

i'm trying to use it for my own purposes

anmonteiro 2016-07-18T19:06:53.000015Z

Om Next

anmonteiro 2016-07-18T19:07:09.000016Z

you can probably use it for your own purposes

2016-07-18T19:07:20.000017Z

I wrote this macro for syntatic sugar

(defmacro defui [name q &amp; 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))}))))

anmonteiro 2016-07-18T19:07:21.000018Z

but statics are elided in advanced compilation

2016-07-18T19:07:34.000019Z

esentially it let's me get the factory function on a defui by using @

2016-07-18T19:07:40.000020Z

so @TabUnion

2016-07-18T19:07:44.000021Z

but it's choking advanced

2016-07-18T19:08:04.000022Z

that's probably why then

anmonteiro 2016-07-18T19:08:57.000023Z

@jasonjckn: try (deref (.. MyComponent -prototype)) instead

anmonteiro 2016-07-18T19:09:21.000024Z

if your troubles go away, you’ll know it was because of that

2016-07-18T19:09:26.000025Z

k

mahinshaw 2016-07-18T19:42:38.000026Z

@anmonteiro: Thanks for filing that in for me.

currentoor 2016-07-18T23:01:51.000027Z

@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

currentoor 2016-07-18T23:03:20.000029Z

lets me use sablono in the body and omit the om.next protocol names

adambros 2016-07-18T23:04:24.000030Z

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

adambros 2016-07-18T23:05:12.000031Z

i also had a variant that would let you do something like

(defui SomeComp
   :query some-query
   :render some-fn)

currentoor 2016-07-18T23:05:49.000033Z

@adambros: cool, i might steal some ideas here

adambros 2016-07-18T23:06:50.000034Z

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

currentoor 2016-07-18T23:07:10.000035Z

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

adambros 2016-07-18T23:07:11.000036Z

and then some sort of panel open up that would let you query & inspect app state

adambros 2016-07-18T23:07:31.000037Z

right, well untangled-template should be coming out soon

adambros 2016-07-18T23:07:50.000038Z

i could see a case for an —experimental option

adambros 2016-07-18T23:08:28.000039Z

we could put stuff related to defui wrappers in that

currentoor 2016-07-18T23:10:15.000041Z

yeah that would be cool

currentoor 2016-07-18T23:13:16.000042Z

@adambros: i remember tony mentioning something about having a UI kit of components

currentoor 2016-07-18T23:13:37.000043Z

maybe we could use my react bootstrap wrapper?

currentoor 2016-07-18T23:13:54.000044Z

as a starting point

adambros 2016-07-18T23:13:59.000046Z

what is a react bootstrap wrapper?

adambros 2016-07-18T23:14:17.000049Z

do i just need to google it ?

currentoor 2016-07-18T23:14:23.000050Z

https://github.com/currentoor/untangled-starter

currentoor 2016-07-18T23:14:52.000052Z

the first section of that readme, this one cljc file basically https://github.com/currentoor/untangled-starter/blob/master/src/untangled_starter/bootstrap.cljc

currentoor 2016-07-18T23:15:13.000054Z

gives you a clojurescript-y api for all these components https://react-bootstrap.github.io/components.html

adambros 2016-07-18T23:15:19.000055Z

i see

currentoor 2016-07-18T23:15:58.000056Z

unlike many vanilla react components they don't require you to mess around with local state so it's clean to use with cljs

currentoor 2016-07-18T23:17:07.000057Z

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

currentoor 2016-07-18T23:17:23.000058Z

also comes with a grid systems, which is pretty nice

currentoor 2016-07-18T23:18:38.000059Z

plus customizing bootstrap styles with less/scss variables is pretty easy

adambros 2016-07-18T23:20:55.000061Z

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

currentoor 2016-07-18T23:21:26.000062Z

right yeah i don't think it would make sense to be part of untangled directly, a contributor library perhaps?

adambros 2016-07-18T23:21:54.000063Z

volt batteries included untangled

adambros 2016-07-18T23:22:04.000064Z

or lotus as a pun off of om

currentoor 2016-07-18T23:22:17.000065Z

lotus?

tony.kay 2016-07-18T23:22:47.000066Z

strands?

adambros 2016-07-18T23:23:03.000067Z

maybe im thinking of a different word

tony.kay 2016-07-18T23:23:05.000068Z

(bits of untangled thread)

tony.kay 2016-07-18T23:23:15.000069Z

untangled-strands

adambros 2016-07-18T23:23:35.000070Z

braid?

adambros 2016-07-18T23:23:39.000071Z

knot

currentoor 2016-07-18T23:23:41.000072Z

how about untangled-knots

tony.kay 2016-07-18T23:23:46.000073Z

😞

currentoor 2016-07-18T23:23:51.000074Z

or knot-untangled?

adambros 2016-07-18T23:23:51.000075Z

sounds like rope

tony.kay 2016-07-18T23:24:03.000076Z

I think knots and braids are what we're trying to avoid!

adambros 2016-07-18T23:25:03.000077Z

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 #humblebrag

adambros 2016-07-18T23:25:09.000078Z

xD

currentoor 2016-07-18T23:25:24.000079Z

jeez lol