This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-08
Channels
- # aws (4)
- # beginners (81)
- # boot (65)
- # cljs-dev (10)
- # cljsjs (1)
- # cljsrn (12)
- # clojure (26)
- # clojure-austin (2)
- # clojure-dusseldorf (2)
- # clojure-russia (123)
- # clojure-spec (23)
- # clojure-uk (12)
- # clojurescript (36)
- # cursive (11)
- # datomic (39)
- # events (1)
- # hoplon (25)
- # incanter (4)
- # leiningen (3)
- # off-topic (5)
- # om (31)
- # re-frame (24)
- # reagent (13)
- # ring-swagger (2)
- # rum (10)
- # untangled (3)
- # yada (10)
@anmonteiro I guess my example is too trivial, what if the query has some nested subqueries, etc?
If a Counter component works fine in isolation (mounted on a div as seen on many tutorials), but fails when rendered from the render method of a Root component (only after a transaction), what should I put in my Root component query?
(om/get-query CounterComponent)
@nha
the parent component should contain the queries of all the children and compose all the way up to root
@danielstockton and then pass it down to the component manually? that seems to work 🙂 Not sure yet how I can make that work with routing though
Yep, principle is the same with routing, shouldn't make a difference.
I am missing something: why is it showing the values after I click on it? (ie. not the initial state)
i wouldnt expect it to show anything, you're not passing anything to counter factory
[:current-route :something-else {:counter ~(om/get-query Counter)}]
is the query you want in your Root component
then get counter and pass it to the counter component
`[:current-route :something-else {:counter ~(om/get-query Counter)}]
don't forgot to quote it ^^
the only non-static part of that expression is unquoted anyway, so what am I missing (I've seen this in examples and not understood)
@iconara you're totally right, i don't think you do actually
@danielstockton ok, thanks for confirming that I'm not crazy 🙂
i might be wrong, maybe someone else can confirm
I will have to write some logic with routing though (since the component to render changes with the route)
routing is basically a root component with a union query of all the pages, switching the child component and what gets passed to it
you shouldnt have to make any adjustments to what you've done here
the Root you defined here will be a child of the routing component, which is the real root
compassus is a lib that does it for you and hides most of the gory details
I heard about it ^^ I would like to understand a bit more though before using it. I don't understand it's tradeoffs.
I am not sure also why it has to wrapt the call to om in compassus/application
instead of providing a RouterComponent
(for instance) and if it would prevent me from using things that also wrap some om calls (like untangled, but there could be something else again in the future).
gotcha
its definitely worthwhile understanding how it works and knowing you can do it yourself
@jfntn did you figure out your issue? you have tempIDs client-side and want to merge-with
data server-side?
@sova correct. We have that working fine for mutations, mostly because we use datomic so there is little work required. For reads things get a bit more involved and though I have it working now I rely on a rather complicated custom merge function