On Wed, Jan 22, 2014 at 6:34 PM, kovas boguta <[email protected]>wrote:

> On Wed, Jan 22, 2014 at 1:42 PM, David Nolen <[email protected]>
> wrote:
> > om.core/get-shared leaves the door open for components requesting some
> > global service without resorting to cljs.core/exists?.
>
> Not clear to me what that means. Is there more to it than "get-shared
> is for things that don't change, :opts is for things that can change?"
>

With :opts you can chose to pass things down or not. Not useful for global
information or services.


> > Not true. React has exactly the same problem. There's no public way to
> get
> > at component state deep in the render tree.
>
> Fair enough. I'm still in the "local state is poison" camp though.
> Hard to get at, and against the grain of the value that Om provides.
> Being able to hold the complete state in your hand, rather than
> scattered across implementation details, is awesome.
>

In the Om model people can choose how they divide up their state. If you
want to save everything in application state, fine. But many applications
will not want to do this. That said, I think it's useful to be able to
force a component to write its local state to some more durable location
and this is what I want to explore.


> > application state and component local state are very different with
> respect
> > to consistency.
>
> I think I recall seeing a discussion about this, could you provide a
> pointer or re-summarize?
>

Application state is only consistent during renders. Anything outside the
render loop (event handlers, go loops) is not guaranteed to have a
consistent picture of the application state. This not true for component
local state, it's always consistent.


> The way I think about it is, look at atoms, refs and agents. Yes they
> are all a bit different, yet somehow it still feels like the same API.
> Similar deal with channels that having different buffers.

> It should not be co-located if it is not something you intend to snapshot.
>
> This is an interesting point.
>
> How useful are snapshots if you don't capture local state? I would
> expect that undo would bring back exactly back to the state I had
> before.
>

Extremely useful. I don't need to save every mouse movement when I'm
sorting a sortable. I just want to undo the actual sort states.

David

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