It might have been unclear in my earlier email when I said we need to wrap 
cursor calls in on-changes.  We can efficiently scan indexes in NativeStore 
using database cursors, so I should have said you need to wrap derive function 
calls and store operations like get and cursor scans in on-changes. 

—
Sent from Mailbox

On Tue, Oct 7, 2014 at 10:30 AM, Viksit Gaur <[email protected]> wrote:

> Thanks for the insight, Ian. Look forward to the example.
> - Viksit
> On Tuesday, October 7, 2014 8:43:41 AM UTC-7, Ian Eslick wrote:
>> NativeStore can be passed as a value in a cursor, but since it always is = 
>> to itself, it would have no effect on Om's shouldComponentUpdate 
>> calculation.  Instead, I just pass it as shared state.  
>> 
>> NativeStore is intended as an alternative method for managing state in Om 
>> via the Derive library (http://github.com/vitalreactor/derive).  In my 
>> system, cursor state only passes dynamic UI state and key parameters, such 
>> as a todo-id and an edit flag.  The bulk of the TODO element data is read 
>> from NativeStore.  I will stress that for relatively simple systems like the 
>> TODO app, NativeStore is serious overkill.  It makes sense when your data 
>> model is large and/or complicated such as having a graph-like structure or 
>> many cross-dependencies.  I have all of the above in my app which is about 
>> to cross 10k lines of CLJS.
>> 
>> The way this integration works is described at the bottom of the NativeStore 
>> README.md.  In short, you need to wrap any calls to derive functions or 
>> cursors with the derive/on-changes macro which registers a callback with the 
>> store so that the component's om/refresh! method is called when a 
>> NativeStore transact! updates any of the data that the component accessed 
>> which in turn causes the component to be added to the Om render queue.
>> 
>> The interactions here are a little subtle, and not quite as easy to reason 
>> about as the cursor model, so I'll work up a simple example/tutorial of 
>> usage in the NativeStore repository tonight to illustrate Om integration.  
>> This will work equally well for other Clojurescript React wrappers I believe.
>> 
>> Ian
> -- 
> Note that posts from new members are moderated - please be patient with your 
> first post.
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "ClojureScript" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/clojurescript/LgJue_mbBew/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to