om

Please ask the channel first, not @dnolen directly!
sova-soars-the-sora 2017-12-11T00:52:42.000062Z

So I would really like a framework focused on serverside-rendering and adding real-time updates to elements once the page has loaded and the javascript has been engaged. React seems to be the most sensible way towards this (keep track of react keys while dishing pages out from the server and update elements once the js loads clientside). Are there any examples of this workflow floating around?

rkiouak 2017-12-11T17:55:59.000631Z

Hi-- beginner question with om.next-- I have a sample/toy app using om.next on the front end with transact, query, etc. working running through the reconciler. I'm now wondering how I can replicate the react behavior of local state in a component via this.setState ({...})-- e.g. a transact! seems both unnecessary and undesirable as no other component will need to track this state. When I try (om/set-state! this {:startDate "01/01/2018"}), i get a "No queries exist for component path ..." with my core/reconciler comp and the component i'm trying to set state on, and its not clear to me what i'm doing wrong. Anyone around and willing to help me understand how to do this?

rkiouak 2017-12-11T18:09:21.000728Z

the shorter form of this question might be: must i query down the component chain for any component on which i want to set state? (this seems to be more propslike than state a.f.a.i. am familiar with react, hence why i am naively thinking this isn't the case)

peeja 2017-12-11T18:41:21.000461Z

I'm trying to install 1.0.0-beta2-SNAPSHOT to get React 16 support, but I can't find it. Are snapshot builds not actually published?

rkiouak 2017-12-11T19:45:05.000673Z

so it seems like adding:

Object
(initLocalState [this]
                  {:startDate (f/unparse (f/formatters :date) (cljs-time.core/now))
                   :endDate (f/unparse (f/formatters :date) (cljs-time.core/plus (cljs-time.core/now) (cljs-time.core/days 7)))})
lets me get state without the queries error, and i can set-state! in an :onChange and it works, but for each onChange event fire, I see the "No queries exist..." error

rkiouak 2017-12-11T19:48:01.000059Z

I've not been able to find any documentation around this sort of state input manipulation... any help on the "om.next" approach to this would be great (from the todo-mvc examples, it seems pretty clear a simple transact! and props pass through would work, but I'm looking to take more of a react component setState approach here than a props based central data store)

2017-12-11T20:53:05.000359Z

@mrkiouak om/set-state! first sets the state locally (if your component implements ILocalState) and then schedules a render via the reconciler (assuming you have one). The No queries exist error is coming from the latter, and probably means you've done something that isn't allowed with your queries.

2017-12-11T20:55:19.000489Z

If you're only interested in setting the state locally, you can use om/react-set-state! which literally calls setState on the component, but doesn't involve the reconciler.

2017-12-11T20:57:29.000241Z

I've used this for performance-critical things where I don't want to schedule renders via the reconciler, but I think om/set-state! is the preferred way, and will work fine once you've figured out what's causing the query error.

rkiouak 2017-12-11T22:17:24.000544Z

@jthomson -- thanks for explaining both effects of the om/set-state!, I couldn't tell whether or not this was a direct effect of the state call or not. Is there a good reference for ILocalState other than the source code? I'm having trouble finding things like this protocol I would know I want to/need to use if I knew about it, but simply am not aware and not sure if a reference exists where i might find something like this.

rkiouak 2017-12-11T23:30:09.000349Z

@jthomson I dont see the error at any point except when set state is called-- e.g., if i understand your above, i should see the error thrown any time offending component is rendered, but the query exception only appears on set state call, not on a page refresh. Did I misunderstand the issue, or does this suggest your above intuition isn't the case?