This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-08
Channels
- # aleph (5)
- # announcements (3)
- # aws-lambda (16)
- # babashka (17)
- # beginners (59)
- # calva (168)
- # clerk (4)
- # clj-kondo (62)
- # clojure (77)
- # clojure-belgium (4)
- # clojure-brasil (10)
- # clojure-ecuador (3)
- # clojure-europe (41)
- # clojure-losangeles (2)
- # clojure-nl (2)
- # clojure-norway (24)
- # clojure-uk (2)
- # clojurescript (44)
- # clr (21)
- # community-development (7)
- # conjure (1)
- # cursive (3)
- # datalevin (15)
- # datomic (1)
- # deps-new (12)
- # emacs (45)
- # events (1)
- # fulcro (8)
- # funcool (7)
- # graphql (5)
- # hugsql (15)
- # jobs (2)
- # matcher-combinators (17)
- # meander (14)
- # membrane (31)
- # pathom (28)
- # pedestal (6)
- # practicalli (6)
- # re-frame (12)
- # releases (1)
- # remote-jobs (1)
- # shadow-cljs (32)
- # tools-deps (8)
- # vim (16)
I want to inject subscriptions in event handler, and I am wondering if this (https://github.com/den1k/re-frame-utils/blob/master/src/vimsical/re_frame/cofx/inject.cljc) is the right way to go about it. I have thought of an alternative where I take out the logic in subscriptions and put it somewhere else so that the event handler can use it (a function that takes in db and other inputs and outputs a value). But I figure that is probably not cache-friendly like how subscriptions are.
There's a third way, where you cache the value manually under some key in app-db. Global interceptors can help with that.
Note that the subscription injector you’ve linked will also cache miss if you decide to use it. IIRC there is a chance of caching when a component is already deferring the sub
There are two approaches I usually see: • if no components use the sub, bite the bullet and compute the sub — the db is always with you in an event handler • if a component uses the sub, find a way to pass the value into the event vector
I am using this, and I am getting "Subscribe was called outside of a reactive context." warnings on js console. How do I remove this? (I have a vague sense I want to use meta for this, but not sure which)
Also, can you elaborate on using global interceptors for caching values? Would it be something like if values A or B changed, recompute C (which depends on A and B)?
Dunno about the warning, haven't looked into it. I know the reason for it but now how to suppress it. But people have asked this before, specifically in this context - maybe there's something in the issue tracker of that project or maybe you can find something in here. Regarding global interceptors - yes, exactly.