This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-03
Channels
- # announcements (8)
- # aws (2)
- # babashka (16)
- # beginners (173)
- # calva (13)
- # cider (4)
- # cljfx (6)
- # cljs-dev (108)
- # clojure (63)
- # clojure-australia (2)
- # clojure-dev (10)
- # clojure-europe (73)
- # clojure-italy (8)
- # clojure-nl (4)
- # clojure-norway (5)
- # clojure-uk (4)
- # clojurescript (49)
- # clojureverse-ops (4)
- # community-development (3)
- # core-async (23)
- # cursive (3)
- # data-science (5)
- # datomic (25)
- # emacs (3)
- # events (1)
- # fulcro (13)
- # helix (5)
- # introduce-yourself (1)
- # lein-figwheel (1)
- # lsp (36)
- # malli (1)
- # meander (2)
- # membrane (4)
- # music (8)
- # nextjournal (51)
- # off-topic (47)
- # other-languages (5)
- # pathom (31)
- # pedestal (5)
- # planck (14)
- # polylith (5)
- # portal (1)
- # re-frame (30)
- # react (2)
- # reagent (24)
- # releases (1)
- # rewrite-clj (18)
- # ring (9)
- # sci (33)
- # shadow-cljs (49)
- # testing (3)
- # tools-build (21)
- # tools-deps (29)
- # vim (19)
- # web-security (1)
- # xtdb (12)
How do we get fast refresh for reagent (preserving state while making changes to css or elements) + shadow-cljs
I save state to local storage and then read it back out.
(defn ^:dev/before-load stop
[]
(save-my-state @app-state))
(defn ^:dev/after-load start
[]
(reset! app-state (read-my-state)))
its taken for granted in modern React frameworks that your state gets preserved when making changes
what's interesting is that inspiration for fast refresh arguably came from clojurescript world (figwheel), but seems like we've regressed as a community. defonce
only works if you're using a central state atom
@UPD88PGNT thanks for going the extra mile to dig that up! It means a lot to me!
I like to limit disk reads / writes if possible since I'm paranoid about preserving the life of SSDs and not hammering it if not necessary 😅 . It's probably OCD, but I really can't help think about that. I prefer sessions to remain in memory (faster as well) and only persisted when truly needed.