This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-05-22
Channels
- # announcements (1)
- # beginners (109)
- # boot (2)
- # calva (26)
- # cider (6)
- # circleci (6)
- # cljsrn (3)
- # clojure (77)
- # clojure-dev (5)
- # clojure-europe (28)
- # clojure-finland (1)
- # clojure-hamburg (1)
- # clojure-italy (21)
- # clojure-japan (13)
- # clojure-nl (36)
- # clojure-spec (22)
- # clojure-sweden (4)
- # clojure-uk (105)
- # clojurescript (91)
- # community-development (8)
- # cursive (60)
- # datascript (3)
- # datomic (4)
- # emacs (33)
- # fulcro (19)
- # graalvm (38)
- # hoplon (4)
- # instaparse (1)
- # jobs (1)
- # leiningen (22)
- # off-topic (14)
- # pathom (2)
- # perun (4)
- # planck (5)
- # re-frame (10)
- # reagent (1)
- # reitit (11)
- # rum (11)
- # shadow-cljs (97)
- # tools-deps (82)
- # vim (53)
(rf/reg-sub
::series
(fn [db [_ ser-id]]
(get-series ser-id)))
(rf/reg-sub
::status
:<- [::series [_ ser]] ;; <- what goes here for args?
(fn [ser _]
(:status ser)))
can i pass arguments to an "upstream" subscription? my sub looks like (rf/subscribe [::that-ns/status ser])
- there isn't an example in https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs (unless i'm missing it...)
you can. e.g. you could hard code a sub for an id with
(rf/reg-sub
::status-1
:<- [::series 1]
(fn [ser _]
(:status ser)))
see here though https://github.com/Day8/re-frame/blob/master/docs/SubscriptionsCleanup.md#a-final-faq
I think if you skip the syntactic sugar and write out the signal function, you’ll get the same query vector as the subscription function:
(rf/reg-sub
:my-app/my-sub
(fn [query-v]
(let [[_ arg] query-v]
(rf/subscribe [:my-app/my-other-sub arg]))
(fn [sig]
(get sig :some-attr)))
I’m on break at a company day-long mtg, so I don’t have time to fire up a repl and check that, but I’m referring to the todomvc example here, https://github.com/Day8/re-frame/blob/master/examples/todomvc/src/todomvc/subs.cljs, starting about line 31
got it - much appreciated, @minimal and @manutter51!!! Thanks!