This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-30
Channels
- # announcements (41)
- # aws (2)
- # aws-lambda (1)
- # babashka (51)
- # babashka-sci-dev (15)
- # beginners (56)
- # calva (15)
- # cider (8)
- # clojars (6)
- # clojure (107)
- # clojure-dev (6)
- # clojure-europe (33)
- # clojure-france (3)
- # clojure-nl (4)
- # clojure-sg (2)
- # clojure-uk (8)
- # clojurescript (16)
- # cursive (11)
- # data-oriented-programming (1)
- # datomic (4)
- # events (11)
- # fulcro (15)
- # graphql (6)
- # helix (17)
- # holy-lambda (1)
- # improve-getting-started (14)
- # integrant (39)
- # jobs (14)
- # lsp (36)
- # malli (3)
- # nrepl (8)
- # off-topic (26)
- # other-languages (1)
- # polylith (21)
- # portal (7)
- # practicalli (17)
- # re-frame (7)
- # react (4)
- # reitit (1)
- # remote-jobs (6)
- # sci (1)
- # shadow-cljs (45)
- # spacemacs (12)
- # tools-deps (5)
- # xtdb (26)
Is it possible to avoid re-initializing the database on every save while in development mode?
(defn ^:dev/after-load render
"Render the toplevel component for this app."
[]
(rf/dispatch [:initialize-db])
(rdom/render [app] (.getElementById js/document "app")))
(defn ^:export main
"Run application startup logic."
[]
(init-analytics!)
(render))
(defn ^:dev/after-load render
"Render the toplevel component for this app."
[]
(rdom/render [app] (.getElementById js/document "app")))
(defn ^:export main
"Run application startup logic."
[]
(init-analytics!)
(rf/dispatch [:initialize-db])
(render))
That partially solves it, but still internal component reagent atoms get reset on reload. Is that avoidable or just an inherent result of the re-render?> internal component reagent atoms get reset on reload If you consider something a part of your app's state, use re-frame's app-db for that - don't use Reagent ratoms.
It's the result of re-render, it's the result of code re-evaluation upon code reloading.
The only solution is to move such data outside of a component and define it with defonce
- which is exactly what re-frame does with its app-db.
That makes a lot of sense. Thank you once again @U2FRKM4TW for such great and fast answers !
👍 1