Fork me on GitHub
#fulcro
<
2023-01-26
>
Jakub Holý (HolyJak)13:01:12

Hm, don’t we have GH action checking that? Or does it only run on pull requests? Oh yeah, https://github.com/fulcrologic/fulcro/blob/main/.github/workflows/test.yml#L3. Perhaps we should enable it on push to master as well?

Hukka11:01:35

Is there any ready made helper for returning a component to initial state?

tony.kay12:01:33

Merge component and get initial state

Hukka12:01:03

Yeah, I went with that, in addition to getting the ident too

tony.kay12:01:08

Though that won't clear anything that isn't mentioned

Hukka12:01:23

Though then I realized that for this use (logout), there's state I'd need to reset all over the place

Hukka12:01:43

I actually used a mutation that swaps in the initial state

tony.kay12:01:48

There are some other helpers in the normalized state namespace. For example I think there are some garbage collection functions in there

Hukka12:01:31

For now I just force a page reload, until I get some good ideas how to make sure that Something still doesn't have dangling state left from whatever was there before the logout

tony.kay12:01:32

Oh, for a log out, you can just do a reset of the state atom from get initial state, then reinitialize your routers etc

tony.kay12:01:36

Of course that doesn't fix any stateful things you might have that are not in the state Atom

tony.kay12:01:31

You could also unmount the app, create a new app, and mount that. That's more of a nuke of the world solution

Hukka12:01:22

Yeah, those would at least avoid the roundtrip to load the page again