mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-25 15:15:19 +00:00
fix(nuxt): don't refresh
when hydrating when data is present (#20916)
This commit is contained in:
parent
d2e14b678b
commit
2cdc22a746
@ -135,7 +135,7 @@ export function useAsyncData<
|
|||||||
(nuxt._asyncDataPromises[key] as any).cancelled = true
|
(nuxt._asyncDataPromises[key] as any).cancelled = true
|
||||||
}
|
}
|
||||||
// Avoid fetching same key that is already fetched
|
// Avoid fetching same key that is already fetched
|
||||||
if (opts._initial && hasCachedData()) {
|
if ((opts._initial || (nuxt.isHydrating && opts._initial !== false)) && hasCachedData()) {
|
||||||
return getCachedData()
|
return getCachedData()
|
||||||
}
|
}
|
||||||
asyncData.pending.value = true
|
asyncData.pending.value = true
|
||||||
|
@ -15,14 +15,14 @@ if (count || data.value !== 1) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
timeout = 100
|
timeout = 100
|
||||||
const p = refresh({ dedupe: true })
|
const p = refresh({ dedupe: true, _initial: false })
|
||||||
|
|
||||||
if (process.client && (count !== 0 || data.value !== 1)) {
|
if (process.client && (count !== 0 || data.value !== 1)) {
|
||||||
throw new Error('count should start at 0')
|
throw new Error('count should start at 0')
|
||||||
}
|
}
|
||||||
|
|
||||||
timeout = 0
|
timeout = 0
|
||||||
await refresh()
|
await refresh({ _initial: false })
|
||||||
|
|
||||||
if (process.client && (count !== 1 || data.value !== 1)) {
|
if (process.client && (count !== 1 || data.value !== 1)) {
|
||||||
throw new Error('override should execute')
|
throw new Error('override should execute')
|
||||||
|
Loading…
Reference in New Issue
Block a user