Fork me on GitHub
#om
<
2016-09-23
>
levitanong08:09:01

Is anyone here experienced in prerendering om.next apps server-side?

urbanslug09:09:56

Shouldn’t transitioning the app-state cause the components to re-render?

anmonteiro10:09:39

@levitanong: you could say so I suppose :-)

levitanong10:09:32

@anmonteiro: so I'm doing something based on your prerendering sample. https://github.com/omcljs/om/issues/782

anmonteiro10:09:32

Does it work on the client?

anmonteiro10:09:52

Could be a #?:clj issue

anmonteiro10:09:03

@levitanong: from the stacktrace I think it would help if you could share the query & the data

levitanong12:09:01

@anmonteiro: it does work on the client. Will do once I get home. :) I am currently out. Thanks for checking it out, man!

anmonteiro12:09:55

@levitanong no problem. boarding a flight soon so don’t expect me to look at it soonish 🙂

levitanong12:09:49

safe flight! :D

alex-glv19:09:47

.. maybe a stupid question about Om and React. Do Om and React implement different rendering loops? Also, in React, state is defined per component, in Om state is one global var, but also one can pass initial state to a component, how do they compare?

peeja19:09:45

@alex-glv Not a stupid question at all. They're the same render system, and it's not even really a loop. React components can have local state, but also, the root component's props are fed in from the outside world. In Om (om.core, not om.next), those props are your app state.

peeja19:09:58

(In Om Next, it's not the contents of your app state atom, it's whatever it gets when it runs the query in your root component. But again, it's passing a bunch of data into the root component as props, and then the data trickles down into subcomponents.)

alex-glv19:09:15

I see about props, thanks. About rendering mostly confused by this https://github.com/omcljs/om/blob/master/src/main/om/core.cljs#L1202

peeja20:09:38

@alex-glv Ah, yep. That's sort of what I mean about it not being a loop. React doesn't have a render loop, where it polls for new things to display. Instead, someone tells it the latest data, and it…well, it reacts. This line is Om rate-limiting itself so it doesn't ask React to re-render more quickly than the browser can paint.

peeja20:09:04

I notice the code does use the phrase "render loop"… 🙂

peeja20:09:43

I wouldn't describe it as one, in the classical sense, but it does take the place of a render loop in the architecture.