I spent some time thinking about your problem today and it's leading me towards something which may address it and the numerous variations of this problem. At the moment I only have the following short code snippet - it uses specify in some interesting ways that I think people may be overlooking:
https://github.com/swannodette/om/blob/fcf6d866e95f5765c0d500887cb6b48f32683205/examples/two_lists/src/core.cljs Feel free to ask any questions you may have. Once I've played around with this approach a bit I'll probably collect my thoughts into a blogpost and likely some kind of tutorial. David On Thu, Oct 2, 2014 at 4:39 PM, Todd Berman <[email protected]> wrote: > I am in the middle of writing my first large OM/CLJS app, and have run into > something that feels wrong, and I am curious if other people have come up > with better solutions for it. > > I am writing a CMS-type app that allows you to edit/create data objects that > are stored in various lists. Originally, I was storing them in an atom like: > > {:lists { > "list 1" [{ ... } { ... }] > }} > > However, that causes some issues when items moved from list to list, so > instead I started storing them like: > > {:lists { > "list 1" ["id1", "id2"] > } > :items { > "id1": { ... } > "id2": { ... } > }} > > This generally works, but feels a bit gross, because now om components that > show the list of items must have a reference to their own data, but also the > items themselves in order to generate cursors to pass to om/build. > > As I got further into it, it has gotten a bit uglier (because I added a > datatype that included a list of items of its own type), which is why I am > asking if anyone has any better solutions to an issue like this? > > I could expose the root atom in shared state, but that sounds just like a > different bad idea. > > Any thoughts? > > --Todd > > -- > 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. -- 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.
