Using window.history.pushState to add state other than null to browser history state #62930
kuki-quupi
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
Currently browser's state is by my understanding explicitly reserved for nextjs.
I tried to push state into browser history other than null, but whenever i tried to do that for some reason that state is being expelled from browser history state. Only kind of state that is surviving in browser history state is this:
{
__NA: true,
__PRIVATE_NEXTJS_INTERNALS_TREE: Array(5)
}
Where __PRIVATE_NEXTJS_INTERNALS_TREE is as far as I understand explicitly reserved for parallel and intercepting routes.
Proposal
I would like to have possibility to change state on popState (in other words on back button navigation), where i could for example open/close modals that doesn't need URL.
Pushing state as object into browser history would give developers possibility to build better web apps, where they could leverage state pushed in browser history to open or close modals on mobile devices with back button navigation. With this approach we would be able to build apps that are more like Android or IOS apps that run in browser.
My propose would be to add possibility to push objects to the browser history state alongside current state that is reserved for Nextjs.
Beta Was this translation helpful? Give feedback.
All reactions