mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix: #2854
This commit is contained in:
parent
25d752630a
commit
c6553a39cd
@ -196,6 +196,12 @@ function callMiddleware (Components, context, layout) {
|
|||||||
|
|
||||||
async function render (to, from, next) {
|
async function render (to, from, next) {
|
||||||
if (this._pathChanged === false && this._queryChanged === false) return next()
|
if (this._pathChanged === false && this._queryChanged === false) return next()
|
||||||
|
// Handle first render on SPA mode
|
||||||
|
if (to === from) _lastPaths = []
|
||||||
|
else {
|
||||||
|
const fromMatches = []
|
||||||
|
_lastPaths = getMatchedComponents(from, fromMatches).map((Component, i) => compile(from.matched[fromMatches[i]].path)(from.params))
|
||||||
|
}
|
||||||
|
|
||||||
// nextCalled is true when redirected
|
// nextCalled is true when redirected
|
||||||
let nextCalled = false
|
let nextCalled = false
|
||||||
@ -204,8 +210,6 @@ async function render (to, from, next) {
|
|||||||
<% if(loading) { %>if (from.path !== path.path && this.$loading.pause) this.$loading.pause()<% } %>
|
<% if(loading) { %>if (from.path !== path.path && this.$loading.pause) this.$loading.pause()<% } %>
|
||||||
if (nextCalled) return
|
if (nextCalled) return
|
||||||
nextCalled = true
|
nextCalled = true
|
||||||
const matches = []
|
|
||||||
_lastPaths = getMatchedComponents(from, matches).map((Component, i) => compile(from.matched[matches[i]].path)(from.params))
|
|
||||||
next(path)
|
next(path)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +337,6 @@ async function render (to, from, next) {
|
|||||||
// If not redirected
|
// If not redirected
|
||||||
if (!nextCalled) {
|
if (!nextCalled) {
|
||||||
<% if (loading) { %>if(this.$loading.finish) this.$loading.finish()<% } %>
|
<% if (loading) { %>if(this.$loading.finish) this.$loading.finish()<% } %>
|
||||||
_lastPaths = Components.map((Component, i) => compile(to.matched[matches[i]].path)(to.params))
|
|
||||||
next()
|
next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user