Fork me on GitHub
#re-frame
<
2020-09-03
>
kennytilton00:09:16

Relative noob here: I am seeing a class of bug in which it turns out app-db holds stale state from an earlier context. In one extreme case one user logged out and another logged in (same person, QA testing jumping between users) and the second "user" ran into old state in app-db . Is this a Known Thing(tm)? If so, does it mean we are missing some clean-up idiom? Some initialization idiom? Mistakenly using app-db to pass state between events? Other______? Thx!

p-himik08:09:10

It's a known thing because app-db is an atom that doesn't clear its values by itself. If you want new state, you have to set it yourself, that's it. I can't say anything more specific without seeing an example.

p-himik08:09:38

Also, regarding user authentication - now I just treat that part of the app and not being a part of the SPA. I.e. if a user clicks on the "Log In" button after filling the login information, the page is refreshed. There are two main advantages to this approach: - You guarantee that the state is fully reset - there's just no place for a mistake here - You make the website much friendlier for web password managers that monitor form submissions

kennytilton12:09:58

Awesome. Thx! I am sure we can find a "kickoff" event where app state can be reset.