Fork me on GitHub
#re-frame
<
2021-10-12
>
Franklin12:10:56

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))

lispers-anonymous13:10:40

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])

manutter5113:10:43

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.

manutter5113:10:49

Also +1 on the swap! instead of reset! above.

Franklin13:10:07

I agree 🙂