Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

errors when navigating back and forth from error pages #14693

Closed
danielroe opened this issue Aug 24, 2022 · 6 comments
Closed

errors when navigating back and forth from error pages #14693

danielroe opened this issue Aug 24, 2022 · 6 comments

Comments

@danielroe
Copy link
Member

reproduction: https://stackblitz.com/edit/github-cmeky2-mysxox

[Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core 
  at <NuxtRoot>
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'parentNode')

Context: #13788

@senher
Copy link

senher commented Aug 26, 2022

ca0fd1bbe8a9e2e366a12399c4f819f

@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
@DrJume
Copy link

DrJume commented Feb 17, 2023

A workaround is wrapping the app.vue root component in <template> inside a <NuxtErrorBoundary />:

app.vue:

<script setup lang="ts">
import ErrorPage from './error.vue'
</script>

<template>
    <NuxtErrorBoundary>
        <NuxtLayout>
            <NuxtLoadingIndicator :color="themeColor" />
            <NuxtPage />
        </NuxtLayout>

        <template #error="{ error }">
            <ErrorPage
                :error="error"
                in-error-boundary
                @clear-error="
                    () => {
                        error.value = null
                    }
                "
            />
        </template>
    </NuxtErrorBoundary>
</template>

To be able to clear the error correctly, I needed to create a event to be able to set error.value to null.

@DrJume
Copy link

DrJume commented Feb 17, 2023

To automatically clear the error, like with normal error.vue behaviour, I use:

onMounted(() => {
  if (props.inErrorBoundary) {
    const router = useRouter()

    router.afterEach(() => {
      console.debug('Manually clearing error in NuxtErrorBoundary')
      emit('clearError')
    })
  }
})

@DrJume
Copy link

DrJume commented Feb 17, 2023

The problem seems to only happen, because of an async setup (using await) in app.vue.

@DrJume
Copy link

DrJume commented Feb 17, 2023

Probably assiciated with vuejs/core#6463

Copy link
Member Author

tracking in #13309

@danielroe danielroe closed this as not planned Won't fix, can't repro, duplicate, stale Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants