This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-11-02
Channels
- # announcements (2)
- # aws (13)
- # beginners (52)
- # boot (10)
- # calva (2)
- # cider (23)
- # clara (23)
- # cljs-dev (16)
- # cljsrn (5)
- # clojure (69)
- # clojure-brasil (1)
- # clojure-conj (3)
- # clojure-dev (41)
- # clojure-india (2)
- # clojure-italy (39)
- # clojure-nl (5)
- # clojure-russia (2)
- # clojure-spec (5)
- # clojure-uk (51)
- # clojurescript (78)
- # code-reviews (13)
- # data-science (2)
- # datascript (22)
- # datomic (47)
- # duct (13)
- # emacs (4)
- # figwheel-main (45)
- # fulcro (85)
- # funcool (4)
- # jobs (9)
- # nrepl (106)
- # off-topic (5)
- # pathom (7)
- # pedestal (2)
- # re-frame (17)
- # reagent (32)
- # reitit (7)
- # ring-swagger (2)
- # shadow-cljs (33)
- # spacemacs (4)
- # specter (2)
- # tools-deps (203)
- # vim (1)
hi all, is it possible to trigger an event in re-frame, based on some particular data changing in the database?
its another event, an http request
that's how I do it now, I trigger an event once that http request finishes. But I think I would like to do it when the data changes, so I can disconnect the two
http req success event (saves result + does some data manipulation in the app db). What I would like is to move the data manipulation in its own event if possible
but its not clear to me if its the right approach or I should not go that way
You don’t need to manipulate db directly in http-req-success event. You can use reg-event-fx
and return effects map
{:db your-updated-app-db
:dispatch [::some-other-event]}
that's true, and that's a reasonable approach. I was just wondering if its also reasonable to have events on data changes in an app db, or based on a subscription.
But I suppose that's not possible at the moment and the bigger question for me, is if that would be a sensible model to have in re-frame.
As far as I can see, anything could be an event, even a data change in the db. It should not be limited to actions triggered by a user or time
good point, so you could always bundle your events there :thinking_face:
ok, I think what I want is not really needed. Thanks for your thoughts @valtteri
No problem. 🙂 Often when in doubt, it’s a good idea to revise re-frame docs. Much wisdom there.
yes, indeed. I keep forgetting some of the things, fight re-frame by doing a weird implementation and then go back to the docs only to re-learn a concept again