fix(nuxt): flag async data promise as cancelled only if defined (#27690)

This commit is contained in:
Damian Głowala 2024-06-18 16:05:32 +02:00 committed by GitHub
parent f365a2783c
commit 523a1fad8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -543,7 +543,10 @@ function clearNuxtDataByKey (nuxtApp: NuxtApp, key: string): void {
} }
if (key in nuxtApp._asyncDataPromises) { if (key in nuxtApp._asyncDataPromises) {
if (nuxtApp._asyncDataPromises[key]) {
(nuxtApp._asyncDataPromises[key] as any).cancelled = true (nuxtApp._asyncDataPromises[key] as any).cancelled = true
}
nuxtApp._asyncDataPromises[key] = undefined nuxtApp._asyncDataPromises[key] = undefined
} }
} }