-
Notifications
You must be signed in to change notification settings - Fork 238
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
Splitting up the route definitions from the router config and creation #11044
Conversation
// TODO: remove in Nuxt 3 | ||
const originalPush = router.push; | ||
|
||
router.push = function push(location, onComplete = emptyFn, onAbort) { | ||
return originalPush.call(this, location, onComplete, onAbort); | ||
}; |
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.
We only used push with an empty second argument in one place. I updated that location so we can remove this code.
const resolve = router.resolve.bind(router); | ||
|
||
router.resolve = (to, current, append) => { | ||
if (typeof to === 'string') { | ||
to = normalizeURL(to); | ||
} | ||
|
||
return resolve(to, current, append); | ||
}; |
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 removed this code. It's possible this may cause a regression but I think it's unlikely. I didn't find any obvious places where normalizeURL would make a difference.
@@ -322,7 +322,7 @@ async function mountApp(__app) { | |||
}); | |||
|
|||
// Push the path and let route to be resolved | |||
router.push(path, undefined, (err) => { | |||
router.push(path, () => {}, (err) => { |
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 explained this above. This allowed us to remove the router.push override that nuxt did.
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.
The change looks good to me, but I noticed a loading overlay while manually testing some routes
loading-overlay.mp4
In the first tab, I'm testing these change in my local development environment and a loading indicator is present before rendering local node details.
The second tab is my Rancher Instance that's hosted on DO, no loading indicator is present before rendering local node details.
Can this difference in behavior be related to this change?
I'm not sure. I'll try to reproduce. |
@rak-phillip I've attempted to reproduce but I haven't been able to. Do you have any other changes or unique about your environment? router.mp4 |
@codyrancher nothing special that I can find. As a matter of fact, I'm taking not of this behavior again today while testing a separate branch. I don't think there's a change in behavior related to this PR. |
Summary
Splitting up the route definitions from the router config and creation for clarity
Occurred changes and/or fixed issues
Moved and removed code
Areas or cases that should be tested
Routing, if a page doesn't load it would almost certainly be caused by this change. The e2e tests should show whether this is a problem or not.
Checklist