Fork me on GitHub
#om-next
<
2017-01-05
>
jtmarmon00:01:16

Is SSR part of untangled?

sova-soars-the-sora00:01:36

it's actually part of om next now. (dom/render-to-string Component InitialData)

sova-soars-the-sora00:01:59

And I think AlanKay just added support for it on the dev branch of Untangled. Although it's already supported by the underlying om architecture... still kinda fuzzy for me though, since ideally all you'd have to do is move your (defui ..) and (om/factory)ies to .cljc but i'm having trouble overcoming the "what the funk you talkn' bout willis" when I leave my #js{:className "whateverclass"} in my code.

sova-soars-the-sora00:01:39

(just a little stub in the om wiki about render-to-str)

sova-soars-the-sora00:01:13

@anmonteiro I notice that in your TodoMVC example with ServerSide Rendering you used something from boot.core to overcome the strangeness is parsing #js{} ... is there a vanilla way I can do this with project.clj without using boot? anyway, thanks a lot for your input, I know you're busy so i won't be offended if you never get around to replying fwiw 🙂

jtmarmon01:01:41

man, looking into untangled i like the philosophy but i'm watching the tutorials and the whole :ui/react-key stuff looks really gross. is there a canonical way to deal with re rendering in dev in om-next?

jtmarmon01:01:14

or is that part of om-next and not untangled

jtmarmon03:01:17

does anyone have thoughts/references on a security model when using om-next with datomic pull syntax?

sova-soars-the-sora03:01:35

@jtmarmon so what I have learned is that if you have a "single source of truth" i.e. your datomic storehouse, then on every incremental datomic database change (post-mutation) you can send the transaction and the delta change to the om.next reconciler, and it'll update your whole UI. I am not versed enough yet to chime in wholly on the topic, but I think there are elegant ways of keeping UI elements up-to-date without doing your own book-keeping.

jtmarmon03:01:27

ah well the example in his video was slightly simpler - he just rendered a simple string, but in order to get react to re-render he had to add :ui/react-key to his dom element. seems a bit over complicated for something as simple as live reloading a string element

sova-soars-the-sora03:01:34

Ah, yes, i noticed something like this. in light-table when I was doing (om/render-to-str ...) while it was working for me (xD) i noticed the react-key id kept incrementing ... i think it's a really simple way of "versioning" the dom elements... might be necessary to get the live update but i thought it was pretty much stock stuff... not actually something to tinker with...

exit214:01:20

Anyone here familiar with this error/ Uncaught Error: Assert failed: (or (component? x) (reconciler? x))

hlolli15:01:49

yes, all too well. You are trying to use om function that requires component instance. Only "this" or reconciler can be used. A common mistake I guess is to give it the name of the component instead of its instance (since you can instanciate many instances of the same component).

hlolli15:01:16

Good to think of a component like a protocol (class).

exit216:01:04

@hlolli Strange, I am passing the reconciler

exit216:01:07

(defroute foo-routes "/foo/:bar" [bar]
  (transact! @reconciler [(app/choose-tab {:tab :search})
                          (search/new-query {:status bar})
                              :ui/root]))

exit216:01:16

perhaps my reconciler is nil at that point or something?

hlolli16:01:43

two things here I see, dont deref the reconciler and remember to quote the transaction query(the vector), are 'app/choose-tab and 'search/new-query methods in mutate?

exit217:01:55

@hlolli that seemed to be part of the issue - when quoting the transaction vector how do I get it to interpret the bar param passed in? It appears to be turning it into a string and literally passing ’”bar” as the :status versus the param thats passed

alex-glv23:01:11

@njj You don’t have to deref reconciler, it will just return current state. Try without dereffing.