remix-run / history

Manage session history with JavaScript
MIT License
8.28k stars 961 forks source link

What is your thoughts about deleteAll? #876

Closed EloB closed 3 years ago

EloB commented 3 years ago

I tend to store a lot of states inside browser history state. I think that has the best UX when it comes to forward/backward button in generall not like data loaded from APIs but like a create entry forms/wizards etc. I often store like form data there but lately I've been thinking about security about that. So I been Googling a bit and found out that there is a deleteAll function. Is this something that you would consider to have inside this library? I'm thinking this is a good thing when you log out to delete everything from history so it could not be stolen.

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/history/deleteAll

EloB commented 3 years ago

I might misunderstood the purpose of that function. I tried to use it and I can't see any deleteAll function under history object...

pshrmn commented 3 years ago

That is an API for browser extensions. I also only use state for ephemeral data (e.g. redirect URL after login) because of inconsistencies (in app navigation has state, but direct navigation would not unless you do a replaceState on load). I think that if you need to store local data, localStorage would be preferable and that also has an easy way to clear out all data on logout.