elm-spa-realworld icon indicating copy to clipboard operation
elm-spa-realworld copied to clipboard

Site reloads on logout

Open rosensama opened this issue 4 years ago • 1 comments

I think this is a bug. If you Sign Up and then hit logout, the site will reload from the server as part of the workflow. It's not obvious, but the debugger event count resets to zero and you can see it in the network tab of developer tools.

Since it's a SPA, it shouldn't need to do that. Say you wanted to show a confirmation of successful logout or if there was an error or a farewell message?

rosensama avatar Apr 25 '21 19:04 rosensama

I think just adding href (Route.toHref currentRoute) onto the "Sign out" a tag solves this. Not sure if it's "right". I assume it must make the default routing framework like the destination.

Assuming the page doesn't reload, I am curious what in elm-spa 6.x replaces the Page.load method from elm-spa 5.x. If you stay on the login page after logging out what updates Login.Model.user upon logout without load? It's only read from shared in Login.init, I think. I can see from the guide updated for the 6.0.0 release that you can curry Shared.Model into any of init, update, view or subscribe, but the only way to update Login.Model would be in Login.update and it's not clear how to get that to fire when Shared.Model is modified.

rosensama avatar Apr 26 '21 01:04 rosensama