Fork me on GitHub
#om
<
2016-06-06
>
ag04:06:11

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

ag04:06:42

something needs to be quoted/dequoted/etc?

ag04:06:01

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

peeja13:06:46

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 om.next? Or, is there an orthogonal way to achieve something similar?

cjmurphy13:06:29

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

peeja13:06:19

Ah, sweet.

peeja13:06:15

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

peeja13:06:46

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

anmonteiro13:06:08

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

anmonteiro13:06:51

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

peeja13:06:53

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.

alpheus19:06:17

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: https://anmonteiro.com/2016/02/routing-in-om-next-a-catalog-of-approaches/

alpheus19:06:49

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?

noonian19:06:53

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.

peeja19:06:30

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"]]?

alpheus19:06:03

@noonian that helps, thanks.

alpheus19:06:59

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

anmonteiro20:06:50

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

peeja20:06:38

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

peeja20:06:32

Ooh, specs!