From: Eduardo San Martin Morote Date: Wed, 29 May 2019 10:40:38 +0000 (+0200) Subject: fix: preserve fullPath when redirecting in matcher X-Git-Tag: v4.0.0-alpha.0~361 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=eaf75782c085d38513a3f1fddea255861417e42f;p=thirdparty%2Fvuejs%2Frouter.git fix: preserve fullPath when redirecting in matcher --- diff --git a/__tests__/router.spec.js b/__tests__/router.spec.js index da7bb5ba..6fc4beb2 100644 --- a/__tests__/router.spec.js +++ b/__tests__/router.spec.js @@ -119,7 +119,7 @@ describe('Router', () => { hash: '#fa-2', }) expect(loc.redirectedFrom).toMatchObject({ - fullPath: '/inc-query-hash?n=2#fa', + fullPath: '/inc-query-hash?n=3#fa', path: '/inc-query-hash', }) }) diff --git a/src/router.ts b/src/router.ts index 6d7e6ad2..43651ee0 100644 --- a/src/router.ts +++ b/src/router.ts @@ -90,9 +90,11 @@ export class Router { // target location normalized, used if we want to redirect again const normalizedLocation: RouteLocationNormalized = { ...matchedRoute.normalizedLocation, - fullPath: this.history.utils.stringifyURL( - matchedRoute.normalizedLocation - ), + fullPath: this.history.utils.stringifyURL({ + path: matchedRoute.normalizedLocation.path, + query: location.query, + hash: location.hash, + }), query: this.history.utils.normalizeQuery(location.query || {}), hash: location.hash, redirectedFrom,