This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-24
Channels
- # beginners (113)
- # boot (9)
- # cider (6)
- # cljs-dev (33)
- # cljsjs (1)
- # clojure (73)
- # clojure-italy (4)
- # clojure-russia (6)
- # clojure-spec (13)
- # clojure-uk (21)
- # clojured (1)
- # clojurescript (79)
- # core-async (6)
- # core-logic (4)
- # datascript (5)
- # datomic (5)
- # duct (12)
- # events (1)
- # figwheel (9)
- # fulcro (143)
- # garden (2)
- # leiningen (1)
- # luminus (24)
- # off-topic (1)
- # parinfer (7)
- # protorepl (12)
- # re-frame (4)
- # reagent (32)
- # rum (1)
- # shadow-cljs (46)
- # spacemacs (4)
- # specter (27)
- # sql (6)
- # unrepl (3)
- # videos (1)
Hi, I have a problem with a component: if fails to rerender even though I think it should, how can I debug the situation?
@roti to help us help you, can you provide more information like a code snippet? A random guess is that you 1) not derefing a reagent atom in the component, or 2) the atom you are derefing is a normal clojurescript atom instead of a reagent atom, or 3) you are creating a reagent atom in the view ... but not doing so in a 'form-2' style and the atom is getting recreated every render
I guess that reagent doesn't establish the link because at that time the render function is not yet executed
@roti in dev mode I believe reagent typically warns on deref ratoms in a for. It has at least some detection. Just curious if you didn’t have warnings show up.
@roti if you need to force a reload then calling the reagent/render function again is the best way to do that
@lee.justin.m thanks
I probably need to tell reagent to render everything, not only those components whose ratom has changed
oh sorry, i thought you were manually hooking into some kind of hot reload signal, in which case you would just re-render the top level component in your tree
(defn mount-root []
(reagent/render [top-level-component]
(.getElementById js/document "app")))
yea that will cause a remount. now you may still be experiencing some bugs like the one discussed above where the components do not reflect your data in a way that you expect
next problem: line 10 of the snippet: you have a fn
there that you don’t need and that doesn’t repeat the outer arguments. you should probably just remove it and do the destructuring right in the defn
declaration