This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-08-29
Channels
- # babashka (54)
- # beginners (24)
- # biff (23)
- # calva (14)
- # catalyst (4)
- # cider (20)
- # clj-kondo (17)
- # clojure (65)
- # clojure-europe (14)
- # clojure-norway (177)
- # clojure-uk (1)
- # clojurescript (11)
- # core-typed (4)
- # cursive (10)
- # datomic (39)
- # emacs (21)
- # gratitude (33)
- # honeysql (8)
- # hyperfiddle (57)
- # introduce-yourself (7)
- # jobs (5)
- # leiningen (17)
- # lsp (6)
- # meander (3)
- # missionary (5)
- # pathom (2)
- # polylith (4)
- # re-frame (7)
- # releases (2)
Hi folks. re-frame newbie here. I’m coding my first re-frame app and I’ve been wondering about ways to perform view data cleanup. Specifically, I’m curious if there are common patterns to purge the app db from a view’s specific data when the user navigates away from that view. Any feedback on this subject would be much appreciated. Cheers.
Since you use the term 'navigate', I guess you are using a router? I think that is the best place for such logic. You can add 'init' and 'cleanup' functions/events as metadata to your routes, then dispatch those automatically.
Indeed I am using a router. More specifically reitit, with supports attaching controllers to routes, and my first idea was to use these. Thanks for your input @U08JKUHA9 👍.
As an alternative, if the amount of that data is not that large and you don't have a thousand routes, I'd simply leave it there. It might also bring the benefit of the data being already there when a user navigates to a previously visited route.
Interesting POV, sometimes we all tend to be over-obsessed with resource release. Well, at least I do. 😬 Thanks for the input @U2FRKM4TW 🙌!
Agreed with @U2FRKM4TW, but you can also use the stop controller if you need to clear anything specific.