This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-09-15
Channels
- # aleph (14)
- # aws (5)
- # beginners (144)
- # bitcoin (1)
- # boot (14)
- # chestnut (13)
- # cljs-dev (58)
- # cljs-experience (1)
- # cljsrn (47)
- # clojure (107)
- # clojure-dev (9)
- # clojure-finland (12)
- # clojure-gamedev (4)
- # clojure-russia (2)
- # clojure-sanfrancisco (1)
- # clojure-spec (5)
- # clojure-uk (28)
- # clojurescript (34)
- # cursive (9)
- # datomic (3)
- # emacs (11)
- # garden (16)
- # graphql (9)
- # hoplon (3)
- # jobs (2)
- # juxt (6)
- # off-topic (32)
- # om (10)
- # onyx (1)
- # pedestal (4)
- # proton (1)
- # re-frame (14)
- # reagent (8)
- # ring (1)
- # ring-swagger (34)
- # shadow-cljs (19)
- # sioux-falls (1)
- # spacemacs (16)
- # testing (14)
@jfntn not at the moment, what's the use case? How would you handle cleaning up the subscription instead? Would it be manual?
So we were running into a perf issue with a side-effectful sub that triggers a long-running backend call. That sub is used in a “details” kind of component that’d get unmounted and remounted causing the side-effect to fire-off everytime, eventhough the data fetched is sort of global. Our fix for now is to cache it forever, by adding a timeout fn that clears the on-dispose-arr
Good use case, open up an issue so we can keep track of it
@mikethompson Yes, I think that’s it
So, @borkdude, the explanation that you don’t see the optimistic update is perhaps because it does not come into effect before the actual update happens (after triggering a different event, a http request and so on)?
when you use dispatch
, that is
because the event is parked on a queue along with other events, and perhaps only enacted upon in the next 16ms cycle
and the http-chain is fast enough to complete its roundtrip within your current 16ms cycle
I realize I’m inadvertently rewording some stuff that @mikethompson already said 🙂 I think a whiteboard would be nice right about now!
@mikethompson and I are hampered by not seeing your app in action and not knowing details of your event chain, but if you find that this explanation makes sense, I’ll chalk this down as a victory for us all and make a note of it for when I have to use reg-event-fx
myself 😄
@reefersleep Thanks for thinking along, I think it has to do with refresh cycles/animation frames and this is why dispatch-sync
solves it. For now, consider it solved, I’m already working on other parts.
I’m generally on thin ice when it comes to asynchronous stuff, and with its internal handling of asynchronous events, re-frame
adds another black-box aspect to the mix from my perspective
In my case, it might just be solved by reading up on re-frame
‘s docs/docstrings