Fork me on GitHub

can someone help me with a query syntax… if I have something like this:

static om/IQuery
  (query [this]
    `[{:app/main-menu ~(om/get-query TopNavBar)}
      ({:app/cur-route [:app/routes]} {:active-route ?active-route})
I assumed that in :app/cur-route’s read active-route parameter would show up, but I think there’s something not right with that tricky macro syntax


something needs to be quoted/dequoted/etc?


Oh ok… I guess I have to wrap the second part of the query into ~’


There's experimental support in om.core for components with "local" state which is implemented by storing that state in the app state atom. Is there anything similar in Or, is there an orthogonal way to achieve something similar?


Om Next has local state. Similar to last Om??


Ah, sweet.


If I did that, and wanted to apply that to all of my components, how would I do that? Om doesn't do mixins, correct? (And they're deprecated in React anyhow, IIRC?)


Is there a sensible way to compose a component with something that implements ILocalState?


@peeja: nothing comes to mind other than wrapping defui in a macro


perhaps there’s some other way that I can’t think of right now


Yeah, that might do. I'll dig into it if it seems like a direction we want to go it. I've been curious for a while whether there's an expected way to do things like that that I was missing, but it sounds like it's still an open question.


Trying to follow Antonio Monteiro's instructions for routing via set-query and the remote reads don't happen. After the mutation ('app/change-route! in the example) the read function is called, with the query I expected, and the query has the meta I expected. I've looked at full-query as suggested but I'm still lost. The post is here:


Can you help me understand "It'normal that Om Next sends the full query of the component to the parser following a mutation" in this context?


When a component initiates a transaction like [(app/do-something)] Om will grab the query for the component initializing the transaction and append that to the transaction query as a “follow on read” because it assumes the component that is transacting will need to re-render. So if that components query is [:foo :bar] and it is rendered from the root as {:my-c [:foo :bar]} then the actual query for the transaction will be [(app/do-something) {:my-c [:foo :bar]}]. Disclaimer: this is my understanding and I may be wrong on the specifics.


Is it acceptable for the second element of an ident to be a data structure rather than a scalar value? In DB terms, I'd like my "primary key" to be a composite key. Can I have, for instance, [product/by-manufacturer-and-model-number [:acme "ABC123"]]?


@noonian that helps, thanks.


@peeja the ident is used as an argument to get-in, so I'm gonna guess yes.


@peeja: I think it works in practice, but it’s not supposed to be


So, everything needs to have a simple primary key, like an id?


Ooh, specs!