This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-12
Channels
- # aleph (3)
- # announcements (7)
- # babashka (22)
- # beginners (44)
- # calva (19)
- # chlorine-clover (1)
- # cider (20)
- # clj-kondo (55)
- # clojure (100)
- # clojure-austin (9)
- # clojure-europe (19)
- # clojure-italy (19)
- # clojure-nl (13)
- # clojure-portugal (2)
- # clojure-uk (7)
- # clojurescript (38)
- # community-development (3)
- # conjure (2)
- # cryogen (57)
- # cursive (6)
- # datalog (3)
- # datomic (24)
- # emacs (17)
- # exercism (8)
- # fulcro (3)
- # holy-lambda (8)
- # jobs (6)
- # jobs-discuss (9)
- # joker (3)
- # lambdaisland (5)
- # leiningen (5)
- # music (9)
- # nextjournal (1)
- # nrepl (2)
- # off-topic (9)
- # other-languages (4)
- # pathom (6)
- # polylith (23)
- # re-frame (5)
- # reagent (5)
- # remote-jobs (1)
- # reveal (1)
- # shadow-cljs (3)
- # tools-build (1)
- # tools-deps (3)
- # xtdb (2)
This isn't in the documentation (at least I haven't seen) but I figured I could do it in the repl, pretty nice 🙂
(reset! re-frame.db/app-db (assoc-in @re-frame.db/app-db [:dataview :show-spinner] false))
swap! would be the preferred way to do this.
(swap! re-frame.db/app-db assoc-in [:dataview :show-spinner] false)
However, directly accessing app-db isn't really encouraged (app-db is an implementation detail of re-frame). I find myself dispatching events from a repl manually when I want to do something similar
(ns my.stuff ...)
(rf/reg-event-db
::stop-spinning
(fn [db _]
(assoc-in db [:dataview :show-spinner] false)))
;; Later from your repl
(rf/dispatch [:my.stuff/stop-spinning])
Yeah, you wouldn’t want to code your app to directly tweak app-db like that, but if you’re just doing some quick hacking at the repl it’s fine. A typo or other goof might screw something up, but worst case you just need to reload the page and get a fresh app-db.
Also +1 on the swap!
instead of reset!
above.