fix(nuxt): unref the default value of asyncData when clearing (#30041)

This commit is contained in:
xjccc 2024-11-26 16:45:59 +08:00 committed by GitHub
parent 1b0834facc
commit e180085800
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -525,7 +525,7 @@ function clearNuxtDataByKey (nuxtApp: NuxtApp, key: string): void {
} }
if (nuxtApp._asyncData[key]) { if (nuxtApp._asyncData[key]) {
nuxtApp._asyncData[key]!.data.value = nuxtApp._asyncData[key]!._default() nuxtApp._asyncData[key]!.data.value = unref(nuxtApp._asyncData[key]!._default())
nuxtApp._asyncData[key]!.error.value = undefined nuxtApp._asyncData[key]!.error.value = undefined
nuxtApp._asyncData[key]!.pending.value = false nuxtApp._asyncData[key]!.pending.value = false
nuxtApp._asyncData[key]!.status.value = 'idle' nuxtApp._asyncData[key]!.status.value = 'idle'