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 Daniel Roe
parent c0ecf746da
commit db889f07c9
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

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