fix(nuxt): useState in NuxtClientFallback setup function (#26928)

This commit is contained in:
Julien Huang 2024-04-27 22:01:09 +02:00 committed by GitHub
parent e382045f95
commit 4544eaf228
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -41,9 +41,10 @@ const NuxtClientFallbackServer = defineComponent({
const vm = getCurrentInstance() const vm = getCurrentInstance()
const ssrFailed = ref(false) const ssrFailed = ref(false)
const nuxtApp = useNuxtApp() const nuxtApp = useNuxtApp()
const error = useState<boolean | undefined>(`${props.uid}`)
onErrorCaptured((err) => { onErrorCaptured((err) => {
useState(`${props.uid}`, () => true) error.value = true
ssrFailed.value = true ssrFailed.value = true
ctx.emit('ssr-error', err) ctx.emit('ssr-error', err)
return false return false