Skip to content

Commit

Permalink
fix(vue-app): don't normalise route path if it's valid (#9460)
Browse files Browse the repository at this point in the history
[release]
  • Loading branch information
danielroe authored and pi0 committed Aug 11, 2021
1 parent af49199 commit 1ccd151
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/vue-app/template/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,14 @@ async function createApp(ssrContext, config = {}) {

// Wait for async component to be resolved first
await new Promise((resolve, reject) => {
const { route } = router.resolve(app.context.route.fullPath)
// Ignore 404s rather than blindly replacing URL
if (!route.matched.length && process.client) {
return resolve()
// Ignore 404s rather than blindly replacing URL in browser
if (process.client) {
const { route } = router.resolve(app.context.route.fullPath)
if (!route.matched.length) {
return resolve()
}
}
router.replace(route, resolve, (err) => {
router.replace(app.context.route.fullPath, resolve, (err) => {
// https://github.com/vuejs/vue-router/blob/v3.4.3/src/util/errors.js
if (!err._isRouter) return reject(err)
if (err.type !== 2 /* NavigationFailureType.redirected */) return resolve()
Expand Down

0 comments on commit 1ccd151

Please sign in to comment.