-
-
Notifications
You must be signed in to change notification settings - Fork 5k
Description
What problem does this feature solve?
It makes it possible for other libraries to store and use information from history.state objects as they would not been overridden by vue-router.
I encountered this when I was trying to build a bookmarking feature. I was able to use keys provided by vue-router for this, but I was just thinking that overriding may cause hard-to-find problems in some environments and also because this overriding could be easy to replace by extending.
I mean these two lines in the codebase:
vue-router/src/util/push-state.js
Line 31 in 638278b
history.replaceState({ key: getStateKey() }, '', url) |
vue-router/src/util/push-state.js
Line 33 in 638278b
history.pushState({ key: setStateKey(genStateKey()) }, '', url) |
Using e.g.:
history.replaceState( {...history.state, ... { key: getStateKey() }}, '', url)
could cause less harm. Of course the key attribute would be still overridden.
What does the proposed API look like?
There are no API changes