This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-02
Channels
- # admin-announcements (3)
- # architecture (5)
- # beginners (10)
- # boot (223)
- # cider (13)
- # cljsjs (2)
- # cljsrn (50)
- # clojure (208)
- # clojure-austin (16)
- # clojure-belgium (1)
- # clojure-india (1)
- # clojure-poland (13)
- # clojure-russia (130)
- # clojure-spec (27)
- # clojure-uk (144)
- # clojurescript (135)
- # css (2)
- # cursive (10)
- # datavis (1)
- # datomic (29)
- # dirac (9)
- # funcool (2)
- # hoplon (41)
- # jobs (3)
- # leiningen (6)
- # om (37)
- # onyx (20)
- # pedestal (1)
- # planck (1)
- # proton (4)
- # re-frame (45)
- # reagent (17)
- # rethinkdb (16)
- # ring-swagger (19)
- # schema (5)
- # specter (93)
- # sql (16)
- # test-check (33)
- # untangled (7)
my most basic understanding is that it’s called whenever the component state or app state changes
@krchia: Your understanding sounds correct to me. It should be called just after render
and after the DOM is updated. Are you maybe calling set-state!
from inside did-update
, triggering it a second time?
Can somebody help me to understand why does Om Next component not re-render when state changes?
I am experiencing the same issue as the one describe in SO http://stackoverflow.com/questions/37212917/why-does-om-next-component-not-re-render-when-state-changes
@viebel: that SO example will never re-render because the queries are not composed correctly
maybe you’re having a similar problem with your query structure?
Let me check
@anmonteiro: Two questions: 1. What is not correct in the query composition 2. If it’s not correct, why does it work when updating the state from the REPL
@viebel: so the components have queries like:
(defui Child
static om/IQuery
(query [this]
[:foo]))
(defui Parent
static om/IQuery
(query [this]
[:parent]))
when you add-root!
, you call that with the Parent component
but there’s no composition in the queries, so Om Next can’t know that there’s a child component somewhere
the correct composition would be something like this for the parent’s query:
[:parent {:child (om/get-query Child)}]
state updates because you’re using normal constructs like swap!
. But for Om Next there exists no components below the Root, so it doesn’t know that it has to update
In my case, I have query composition. Render is called on user event but is not called when I am updating the state without any user event (I am triggering a state update every 3 seconds)
Is it clear?
@viebel: do you have a link to the example or can put a minimal case together?
multiple things might be going on so I can’t give a clear answer
This is in Klipse: https://github.com/viebel/klipse/blob/10b020f0c9a37a795a9e5006caf2a760ffe3b441/src/klipse/ui/layout.cljs
I want to trigger code evaluation if the user press Ctrl-Enter
and after 3 seconds of inactivity
The 1st one works fine. The second one is broken (it used to work)
@viebel: right, where is the actual code that updates the state?
@viebel: A number of things might be happening, the example it just too conflated
esp. with the core.async bits
I suggest you make a minimal case I could look at
I don’t have time to grok everything this code is doing
I understand.
Thanks for your time
Can I return two queries from a read function to a remote? I tried an AST with type :root and two children, but then my send function get a query like [[q1 q2]]
which is one vector to much.
@akiel: I think you'll need to override merge-sends
in the reconciler
But normally one is supposed to return only an AST fragment not a root AST? (as the docu says)
I can't recall what the documentation says, but the existent hooks in the reconciler allow you to extend the defaults
So I'd say either is correct
The docu says: Remote query entries must be query expression AST fragments that correspond to the :remotes specified to the reconciler.
@anmonteiro: As I see it, merge-sends doesn’t solve my problem. But thanks nevertheless.