On Thu, Apr 10, 2014 at 6:04 AM, Daniel Kersten <[email protected]> wrote:
> The biggest things for me are that:
>
> 1. Components shouldn't know anything about the structure of the state
> other than what they need themselves - that means that they shouldn't
> themselves know what path gets to the state they act on and they shouldn't
> care what's below that path (other than for what they render/modify
> themselves)
>
> Yep.
>
> 1. Parent components shouldn't have to know about what the child
> components need, especially distant children. That is, if I have a tab
> component which contains a list component where each list element component
> contains a component that shows if the content meets some criteria and that
> criteria is specified on a completely different path in the state, then the
> tab, list and list elements shouldn't need to know about that. Yet updating
> the criteria should automatically update everything appropriately.
>
> Yep
> I'm not sure if something like (om/get-shared owner [:app-state :foo])meets
> these two requirements since the component would need to know the
> path to the data it needs, though I guess you could pass that information
> in as opts or otherwise. I'd like some way of configuring all of this
> externally, maybe as part of root, but then how do you get it to the
> correct components?
>
It can satisfy 1 and 2 if the user can control the cursor generated by
`om.core/get-shared`. This is part of the design.
> An approach might be that you can (optionally) tag a component with a
> keyword *(maybe use the :key or :react-key? though it should probably
> also be possible for the component set its own key rather than (or as well
> as) the parent passing it to build - maybe)* and then in the root you can
> do something like :cursors {:my-component-key #{[:path1] [:path2]}} and
> the paths would be merged into whatever the parent passes to build. Or
> potentially even better - something like what Sean Grove uses, where you
> have a function that selects (and possibly reformats) the data: :cursors
> {:my-component my-transform-fn}
>
Om needs to work without needing users to think very much about
transformation or paths. This is not something people need to consider in
traditional UI approaches and I'd be disappointed to force this kind of
incidental complexity on Om users.
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.