This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-07-20
Channels
- # announcements (7)
- # babashka (16)
- # beginners (58)
- # boot (12)
- # calva (3)
- # cider (11)
- # clj-kondo (9)
- # cljs-dev (8)
- # clojure (82)
- # clojure-europe (9)
- # clojure-italy (11)
- # clojure-losangeles (1)
- # clojure-nl (8)
- # clojure-uk (8)
- # clojurescript (5)
- # css (2)
- # cursive (5)
- # datomic (20)
- # docker (2)
- # emacs (4)
- # figwheel-main (16)
- # fulcro (53)
- # graalvm (17)
- # jackdaw (2)
- # jobs (4)
- # kaocha (6)
- # lambdaisland (2)
- # luminus (2)
- # meander (1)
- # off-topic (146)
- # re-frame (4)
- # releases (1)
- # rum (12)
- # sci (71)
- # shadow-cljs (26)
- # test-check (22)
- # vim (1)
- # xtdb (9)
I've started using derived-atom
as a way to aggregate stuff locally so that that has a reaction before deciding to re-render a component - see https://github.com/CmdrDats/rumperftest/blob/master/src/perftest.cljs#L36-L40 - I'm a bit worried about memory leak with this pattern - will the derived atom watchers get released when the component is no longer in scope? or is there a different way I should be doing this?
there's a related issue for derived atom and watchers https://github.com/tonsky/rum/issues/94
Thanks :) i did see this, but my question is a bit broader - would the pattern I'm using be considered as intended, or should I be doing something entirely different? I find this particularly when dealing with collections where I need to iterate through the collection to embed their components, but then if I just react on the collection itself, any change (obviously) rerenders the entire parent component
@U050CLJ53 The pattern you describe is known (part of optimization of a component) and the issue you describe is also known as @U0FR82FU1 said above.
Something along the lines: https://github.com/g7s/rum/blob/hooks/src/rum/core.cljs#L572
@UKQS17P3L great, thanks for the feedback - use-derived-atom
looks interesting - is this in a fork?
ah, ok - I see the current rum code has:
(defn use-reducer [reducer-fn initial-value]
[initial-value reducer-fn])
(defn use-effect!
([setup-fn])
([setup-fn deps]))
(defn use-callback
([callback] callback)
([callback deps] callback))