This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-18
Channels
- # beginners (22)
- # boot (12)
- # cider (3)
- # cljs-dev (12)
- # cljsrn (8)
- # clojure (101)
- # clojure-nl (5)
- # clojure-russia (13)
- # clojure-spec (5)
- # clojure-uk (15)
- # clojurescript (158)
- # cursive (5)
- # datascript (16)
- # datomic (8)
- # hoplon (11)
- # lumo (33)
- # off-topic (3)
- # om (25)
- # parinfer (1)
- # pedestal (8)
- # protorepl (4)
- # re-frame (8)
- # reagent (5)
- # specter (18)
- # sql (1)
- # testing (11)
- # timbre (1)
- # unrepl (2)
- # untangled (1)
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 ""})]
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 ""})]
The query returns the hosting provider info of any site based on the URL that is passed to it
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): https://github.com/madvas/todomvc-omnext-datomic-datascript
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
In om.next, 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
static
(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