-
-
Notifications
You must be signed in to change notification settings - Fork 916
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
Vue-Router compatibility in window with multiple routers #1031
base: 5.x
Are you sure you want to change the base?
Conversation
File size impactdist (+1,490 bytes)Overall impact on dist files size
Detailed impact on dist files size
Impact on dist files cache8 files in you users cache are now outdated because their content have changed.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before merging this, tests would be necessary. I am not sure if single-spa's patched updateState function should enter into the world of supporting every framework router's idiosyncrasies. My preferred solution would be to get vue router to not be so picky about other things changing history.state
, but am open to discussing this if the Vue team insists that nothing else should be allowed to call history.replaceState()
besides their code.
@@ -94,6 +94,12 @@ function urlReroute() { | |||
function patchedUpdateState(updateState, methodName) { | |||
return function () { | |||
const urlBefore = window.location.href; | |||
|
|||
// issues/1030 - Vue requires 'current' to be set at all times | |||
if (arguments && arguments[0] && !arguments[0]?.current) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer not using the arguments
keyword. Also, the optional chaining on this line seems unnecessary since there's already a check for whether arguments[0]
is truthy.
I'd prefer something like this:
return function (state) {
if (state && !state.current) {
state.current = "";
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @joeldenning ,
i tried solving this on the vue-router side but there seemed to be no flexibility on their end to fix it vuejs/router#1502
Regarding the arguments, where do i get the "state" object?
The arguments seem to be directly applied to the window.history.pushState or window.history.replaceState on the code:
const result = updateState.apply(this, arguments);
Fix for issue #1030