Fork me on GitHub

What is the query syntax to read from the root of the application state using a parameterized join query from a deeply nested component? Links ( only seem to be appropriate for simple ident queries. Here is the query that I am want to be read from the root

'[({:hosting-service [:org]} {:url ""})]


i believe links have to start with an ident (two element vector), there are some more query examples in the tests:


@danvingo thanks, the following seems to work

'[({[:hosting-service _] [:org]} {:url ""})]


np, i've actually never seen an example like that, what is this query returning?


the url of an org that's embedded in a hosting service?


The query returns the hosting provider info of any site based on the URL that is passed to it


ah, so url is the param?


nice, very cool


Has anyone worked on pubsub via Om yet? I'm thinking through what you'd need to do. I think you'd want a send that received the entire root query each time it changed, rather than just a subset of it, which is what a send normally gets if a portion of the UI tree changes its query.


That is, you'd want the entire root query so you could diff it against the last one you saw and decide what to subscribe to and what to unsubscribe from


Alternatively, Om could take responsibility for doing the diffing and give the send the diff


@peeja I implemented a similar approach partially in a project. There, we also subscribe with the root query and push updates to the query to the subscription service whenever it changes. That by itself is probably the easiest part – the trickier part is keeping track of which query (or partial query) of which clients are interested in which parts of the remote db. We got as far as distinguishing between queries for particular data (i.e., parameterized with a specific db record ID such as a specific user ID) or for a collection of data (e.g. all users, kind of like wildcards). And then you’d have to index all client queries smartly, monitor the db for changes, match client queries against these changes and push the right things to the right clients. I think that’s much harder than obtaining the root query. 😉


@peeja have you seen this clever om/datascript/datomic pub sub (using sse):


I want to reset! my state (its a datascript db) but no longer likes it No protocol method IWithMeta.-with-meta defined for type cljs.core/Atom


Any work arounds?


In, should ids that have been updated from tempids to real ids trigger a rerender?


nevermind, it definitely does trigger a rerender in some parts, so I’m obviously doing something wrong


Is there a way to pass arguments when defining (not instantiating or creating) a component that would have that argument as a static property? Ie. is it possible to have

(defui MyComponent
(aaa [_] something-dynamic)
Where something-dynamic is defined somewhere else in the code?


@nha hrm, this is possible:

(defui Foo
  static field foo 42)


not sure if it's what you're looking for


has anyone implemented IO/network retries in and how did you go about?