Unverified Commit c4d0b212 authored by Tim Neutkens's avatar Tim Neutkens Committed by GitHub

Pass in the generated asPath instead of a full url (#4622)

Fixes #4620 

On the server and when navigating pages, the `asPath` is the pathname + query + hash visible to the users, not an url. This makes sure that we keep it consistent between hot reloads.
parent cdfcde16
...@@ -101,9 +101,11 @@ export default class Router { ...@@ -101,9 +101,11 @@ export default class Router {
const { pathname, query } = this const { pathname, query } = this
const url = window.location.href const url = window.location.href
// This makes sure we only use pathname + query + hash, to mirror `asPath` coming from the server.
const as = window.location.pathname + window.location.search + window.location.hash
this.events.emit('routeChangeStart', url) this.events.emit('routeChangeStart', url)
const routeInfo = await this.getRouteInfo(route, pathname, query, url) const routeInfo = await this.getRouteInfo(route, pathname, query, as)
const { error } = routeInfo const { error } = routeInfo
if (error && error.cancelled) { if (error && error.cancelled) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment