This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-16
Channels
- # announcements (7)
- # babashka (8)
- # beginners (48)
- # calva (4)
- # cider (6)
- # circleci (2)
- # clj-commons (14)
- # clj-kondo (3)
- # clj-on-windows (7)
- # cljs-dev (34)
- # clojure (49)
- # clojure-dev (25)
- # clojure-europe (48)
- # clojure-losangeles (1)
- # clojure-nl (4)
- # clojure-norway (33)
- # clojure-uk (2)
- # clojurescript (37)
- # community-development (5)
- # conjure (17)
- # cursive (2)
- # data-science (1)
- # editors (10)
- # emacs (50)
- # events (22)
- # honeysql (11)
- # introduce-yourself (1)
- # jobs-discuss (13)
- # lsp (42)
- # malli (9)
- # off-topic (7)
- # pathom (11)
- # portal (5)
- # re-frame (3)
- # reagent (22)
- # reitit (8)
- # reveal (1)
- # rewrite-clj (4)
- # shadow-cljs (38)
- # xtdb (21)
Hello! I had a https://clojurians.slack.com/archives/C03S1L9DN/p1668595198483429 and it turns out I made an assumption related to subscriptions. I have the following subscription:
(re-frame/reg-sub
::reachable-stops
:<- [::stops]
:<- [::reachable]
(fn [[stops reachable] _]
(filter (comp reachable first) stops)))
I assumed it «triggered» only when both dependencies were not nil.
But apparently, this sub produces something even if reachable
is nil (no key in the DB), which leads to the error.
What’s the pattern to handle this case (only one out of the n dependency has a value)?
Adding defaults solves my problem but hardly looks like a solution. This sub does not «make sense» if only one dependency has a value.✅ 1