Skip to content

Allow arbitrary mutable state within push()/replace() #3022

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

Closed
J-Rojas opened this issue Nov 9, 2019 · 1 comment
Closed

Allow arbitrary mutable state within push()/replace() #3022

J-Rojas opened this issue Nov 9, 2019 · 1 comment

Comments

@J-Rojas
Copy link

J-Rojas commented Nov 9, 2019

What problem does this feature solve?

'Meta' allows for assigning immutable properties to a route. However there is a need to push arbitrary app state whenever a route changes to keep track of historical app state at the time of the route change. 'Meta' does not allow for the use of conditional state based on the route history. Currently the implementation uses the HTML5 history API for pushing state changes, but it does not allow the user to pass in arbitrary state that can be accessed again when going backwards in history. Please expose an extra parameter/object property to the API for this purpose.

What does the proposed API look like?

Proposal:

$router.push({ name: 'my-route1', state: { foo: 'bar' } })
$route.state.foo // 'bar'
$router.go(-1)
$route.state.foo // undefined
@posva
Copy link
Member

posva commented Nov 9, 2019

Duplicate of #2243

@posva posva marked this as a duplicate of #2243 Nov 9, 2019
@posva posva closed this as completed Nov 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants