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.

Reply via email to