This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-05-15
Channels
- # announcements (17)
- # babashka (16)
- # beginners (17)
- # biff (13)
- # cider (63)
- # cljsrn (8)
- # clojure (34)
- # clojure-europe (12)
- # clojure-germany (4)
- # clojure-nl (2)
- # clojure-spec (17)
- # clojure-uk (2)
- # clojurescript (51)
- # code-reviews (1)
- # conjure (15)
- # cursive (16)
- # datomic (10)
- # emacs (4)
- # fulcro (13)
- # graalvm (4)
- # helix (3)
- # introduce-yourself (7)
- # kaocha (2)
- # lsp (4)
- # music (2)
- # off-topic (11)
- # re-frame (2)
- # reagent (3)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (21)
- # spacemacs (4)
- # sql (1)
- # vim (2)
In all of the re-frame docs, signal functions for subscriptions look very simple. If I have a layer-3 "materialised view", it might have a signal function which takes some parameters to pass to lower-level extractors, and the results are processed in the computation function. However, I've started doing something like this:
(re-frame/reg-sub
:foo
(fn [[_ id]]
(let [linked-entity @(re-frame/subscribe [:extractor id])]
(re-frame/subscribe [:other-extractor (:field linked-entity)])))
(fn [entity]
;; do something))
The crucial bit is the dereferencing in the signal function. I can't see an obvious reason for why this is bad, but I can't find any examples of anyone else doing this. Similar things are often done using reg-sub-raw though, so perhaps there's a reason for doing it that way instead? Has anyone encountered this kind of pattern before?