There seems to be a few types of shared state in an Om system:

1. "model"-ish data, e.g. if your app's about cats, a list of cats.
2. "view"-ish data, like whether a given UI panel is shown or hidden
3. coordination-ish data, like async channels so that components can talk to 
each other, e.g. to show or hide panels, to switch the cat being displayed.

Which one or more of these is supposed to go in the global app-state atom?

Suppose that you put both model and view state in the app-state atom:

(def app-state
  (atom {:cats {"Fluffy" {:age 7}
                "Scratchy" {:age 5}}
         :cat-viewer-widget {:current-cat "Fluffy"}}))

How do you provide a cursor to the cat viewer widget without giving it a 
completely global cursor, or without hopelessly intermixing the model and view 
data?

Alternatively, suppose that only the "model" data lives in `app-state` atom.  
Presumably then the view state is component-local, but then that just implies 
you need a globally addressable async channel to talk to it.  Where does one 
put the async channels so that other components can talk to them?  Options 
include:

- Include channels in `app-state` atom
- :shared global component state
- Some other var in scope in the namespace

(This also raises the question of, when you should prefer to om/transact! 
directly vs. use a channel to ask some other process to transact! for you?  But 
I'll leave that one for now.)

Haven't been able to find a write-up on this in the past few days.  Any 
guidance greatly appreciated.  Thank you!

- Elliot

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