-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
support a component to capture component ssr failed and then automatically render it on client #14885
Comments
Hi 👋 ! Just want to say that i love this idea. |
We do have |
this is the current state of what i've been trying to do: export default defineComponent({
props: {
uid: {
type: String,
required: true
}
},
setup (props, ctx) {
if (process.server) {
const error = ref(false)
onErrorCaptured(() => {
error.value = true
// todo report to sentry
useState(`error_component_${props.uid}`, () => true)
return false
})
return () => error.value ? createElementBlock('div') : ctx.slots.default()
}
const mounted = ref(false)
const ssrFailed = useState(`error_component_${props.uid}`)
if (ssrFailed.value) {
onMounted(() => { mounted.value = true })
}
return () => ssrFailed.value ? mounted.value ? ctx.slots.default() : createElementBlock('div') : ctx.slots.default()
}
})
|
merged in nuxt/framework#8216 |
Describe the feature
suggest support a new build-in component: client-only-if-ssr-failed。through this feature,we can avoid the page ssr process was interrupted by errors from some not important components.
i have tried to implement it myself, but i can not find the way to capture the error throwed by slot components.
Additional information
Final checks
The text was updated successfully, but these errors were encountered: