This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-24
Channels
- # admin-announcements (1)
- # alda (22)
- # aws-lambda (1)
- # beginners (9)
- # boot (17)
- # cider (39)
- # cljs-dev (10)
- # cljsjs (1)
- # cljsrn (14)
- # clojure (88)
- # clojure-android (1)
- # clojure-dev (9)
- # clojure-india (1)
- # clojure-russia (271)
- # clojure-spec (5)
- # clojure-uk (101)
- # clojurescript (74)
- # clojutre (11)
- # component (2)
- # cursive (24)
- # datascript (7)
- # datomic (9)
- # dirac (13)
- # docs (3)
- # emacs (4)
- # garden (21)
- # hoplon (9)
- # jobs-rus (5)
- # lein-figwheel (3)
- # leiningen (13)
- # luminus (12)
- # off-topic (1)
- # om (24)
- # onyx (84)
- # proton (3)
- # re-frame (39)
- # reagent (21)
- # rethinkdb (1)
- # slack-help (10)
- # specter (4)
- # test-check (1)
- # untangled (35)
- # yada (2)
I'm using cursors to constrain the scope of access/visibility each component instance has, but all of my components are being rebuild / updated on each change within the ratom, even those outside of the scope of their cursor
is that expected, or am I perhaps doing something to make reagent think components are dirty when they're not?
are you using a cursor or a ratom?
ah sorry, a cursor based on the ratom
no, your assumption is correct - only changes within the scope of the cursor should mark the component as dirty
probably something you're doing elsewhere -- hard to say without seeing the code
So, I have components A, B, and C that contain each other in that order, and which narrow scope with a cursor at each step. C is the only one that swaps on its cursor. I'm a little lost on how those operations could escape that scope.
I should produce a minimal example, but there's a ton of non-react, non-reagent stuff around this bit...
so what counts is where the cursor or ratom is dereffed; it doesn't matter where it's swapped
reagent's render fn are wrapped in (pseudo-code): (track-which-ratoms-are-dereffed (your-render-fn))
that should work
how do you know that A and B are re-rendered? have you added logging to the render fns to make sure?
oh and of course if you deref the ratom anywhere in A or B, those components will rerender
as the cursor is just a view on the ratom
I'll go see if I can produce a minimal sample. Will probably find the problem along the way 🙂
good luck!
oh and make sure you're calling render-component only once
@cemerick hard to tell if this is the problem, but in case you’re not familiar already, take a look at https://github.com/Day8/re-frame/wiki/Creating%20Reagent%20Components