Fork me on GitHub
#om
<
2017-03-18
>
symfrog12:03:48

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 (https://github.com/omcljs/om/wiki/Thinking-With-Links%21) 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 ""})]

dvingo13:03:41

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

symfrog13:03:25

@danvingo thanks, the following seems to work

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

dvingo13:03:08

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

dvingo13:03:41

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

symfrog13:03:18

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

dvingo13:03:43

ah, so url is the param?

dvingo13:03:54

nice, very cool

symfrog13:03:00

🙂

peeja14:03:59

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.

peeja14:03:25

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

peeja14:03:47

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

jannis15:03:30

@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. 😉

sineer19:03:44

@peeja have you seen this clever om/datascript/datomic pub sub (using sse): https://github.com/madvas/todomvc-omnext-datomic-datascript

foobar20:03:00

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

foobar20:03:25

Any work arounds?

lucasbradstreet22:03:15

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

lucasbradstreet22:03:39

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

nha23:03:07

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
static
(aaa [_] something-dynamic)
)
Where something-dynamic is defined somewhere else in the code?

anmonteiro23:03:23

@nha hrm, this is possible:

(defui Foo
  static field foo 42)

anmonteiro23:03:32

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

raspasov23:03:08

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