Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new persistence_type: history_state #2975

Open
olejorgenb opened this issue Sep 3, 2024 · 0 comments
Open

add new persistence_type: history_state #2975

olejorgenb opened this issue Sep 3, 2024 · 0 comments
Labels
feature something new P3 not needed for current cycle

Comments

@olejorgenb
Copy link

olejorgenb commented Sep 3, 2024

When basing the app around internal links which add entries to the browser history it could be useful with a persistence type which stores the values in the history state entries (history.pushState(state, ...)).

I know that ideally most/all such state would be part of the URL as this has more advantages beyond preserving the state on back/forward. But sometimes this can be a bit tricky - using URL parameters for state does require a certain app architecture - so I think it could be useful to easily add some state to the history entry "under the hood".

I think this could be reasonable easy to implement. Do a replaceState({...history.state, ...historyProps}, ...) each time a "history-state persisted" property is changed. Then restore these in a "popstate" event handler.

(I could not find any previous discussion on this topic)

@gvwilson gvwilson changed the title [Feature Request] New persistence_type: history_state add new persistence_type: history_state Sep 4, 2024
@gvwilson gvwilson added feature something new P3 not needed for current cycle labels Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

2 participants