mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
This reverts commit 3c61830a0d
.
This commit is contained in:
parent
3c61830a0d
commit
d85d2fb612
@ -279,7 +279,6 @@ async function render(to, from, next) {
|
|||||||
// Get route's matched components
|
// Get route's matched components
|
||||||
const matches = []
|
const matches = []
|
||||||
const Components = getMatchedComponents(to, matches)
|
const Components = getMatchedComponents(to, matches)
|
||||||
const instances = getMatchedComponentsInstances(to)
|
|
||||||
|
|
||||||
// If no Components matched, generate 404
|
// If no Components matched, generate 404
|
||||||
if (!Components.length) {
|
if (!Components.length) {
|
||||||
@ -372,8 +371,6 @@ async function render(to, from, next) {
|
|||||||
Component._dataRefresh = true
|
Component._dataRefresh = true
|
||||||
} else if (Array.isArray(watchQuery)) {
|
} else if (Array.isArray(watchQuery)) {
|
||||||
Component._dataRefresh = watchQuery.some(key => this._diffQuery[key])
|
Component._dataRefresh = watchQuery.some(key => this._diffQuery[key])
|
||||||
} else if (typeof watchQuery === 'function') {
|
|
||||||
Component._dataRefresh = watchQuery.apply(instances[i], [to.query, from.query])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!this._hadError && this._isMounted && !Component._dataRefresh) {
|
if (!this._hadError && this._isMounted && !Component._dataRefresh) {
|
||||||
@ -494,13 +491,18 @@ function showNextPage(to) {
|
|||||||
function fixPrepatch(to, ___) {
|
function fixPrepatch(to, ___) {
|
||||||
if (this._pathChanged === false && this._queryChanged === false) return
|
if (this._pathChanged === false && this._queryChanged === false) return
|
||||||
|
|
||||||
const instances = getMatchedComponentsInstances(to)
|
const matches = []
|
||||||
const Components = getMatchedComponents(to)
|
const instances = getMatchedComponentsInstances(to, matches)
|
||||||
|
const Components = getMatchedComponents(to, matches)
|
||||||
|
|
||||||
Vue.nextTick(() => {
|
Vue.nextTick(() => {
|
||||||
instances.forEach((instance, i) => {
|
instances.forEach((instance, i) => {
|
||||||
if (!instance || instance._isDestroyed) return
|
if (!instance || instance._isDestroyed) return
|
||||||
|
// if (
|
||||||
|
// !this._queryChanged &&
|
||||||
|
// to.matched[matches[i]].path.indexOf(':') === -1 &&
|
||||||
|
// to.matched[matches[i]].path.indexOf('*') === -1
|
||||||
|
// ) return // If not a dynamic route, skip
|
||||||
if (
|
if (
|
||||||
instance.constructor._dataRefresh &&
|
instance.constructor._dataRefresh &&
|
||||||
Components[i] === instance.constructor &&
|
Components[i] === instance.constructor &&
|
||||||
|
@ -180,24 +180,6 @@ describe('basic browser', () => {
|
|||||||
page.close()
|
page.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
test('/scroll-to-top in the same page with watchQuery function', async () => {
|
|
||||||
const page = await browser.page(url('/scroll-to-top/watch-query-fn'))
|
|
||||||
await page.evaluate(() => window.scrollBy(0, window.innerHeight))
|
|
||||||
await page.nuxt.navigate('/scroll-to-top/watch-query-fn?other=1')
|
|
||||||
let pageYOffset = await page.evaluate(() => window.pageYOffset)
|
|
||||||
expect(pageYOffset).toBeGreaterThan(0)
|
|
||||||
await page.nuxt.go(-1)
|
|
||||||
pageYOffset = await page.evaluate(() => window.pageYOffset)
|
|
||||||
expect(pageYOffset).toBeGreaterThan(0)
|
|
||||||
await page.nuxt.navigate('/scroll-to-top/watch-query-fn?test=1')
|
|
||||||
pageYOffset = await page.evaluate(() => window.pageYOffset)
|
|
||||||
expect(pageYOffset).toBe(0)
|
|
||||||
await page.nuxt.go(-1)
|
|
||||||
pageYOffset = await page.evaluate(() => window.pageYOffset)
|
|
||||||
expect(pageYOffset).toBe(0)
|
|
||||||
page.close()
|
|
||||||
})
|
|
||||||
|
|
||||||
test('/validate should display a 404', async () => {
|
test('/validate should display a 404', async () => {
|
||||||
await page.nuxt.navigate('/validate')
|
await page.nuxt.navigate('/validate')
|
||||||
|
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div>
|
|
||||||
<NuxtLink to="/scroll-to-top/watch-query-fn?test=1">
|
|
||||||
go to the same page with other test
|
|
||||||
</NuxtLink>
|
|
||||||
<NuxtLink to="/scroll-to-top/watch-query-fn?other=1">
|
|
||||||
go to the same page with param other
|
|
||||||
</NuxtLink>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
watchQuery (newQuery, oldQuery) {
|
|
||||||
return newQuery.test
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
div {
|
|
||||||
margin-top: 1500px;
|
|
||||||
}
|
|
||||||
</style>
|
|
Loading…
Reference in New Issue
Block a user