-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Description
Vue version
3.5.13
Link to minimal reproduction
Steps to reproduce
Just open a link and you will see errors when SSR is ON.
When SSR is OFF everything works as expected.
Also, commeting the line with top-level await (making Comp.vue a sync component) will also work fine both with and without SSR.
What is expected?
In SSR mode the page is expected to be blank white for 1 second and then display error message from App.vue.
This works as expected with SSR turned off.
Basically onErrorCaptured should be triggered, child setup and <template> render immediately stopped and error message from parent component shown.
What is actually happening?
In SSR mode the page is blank for 1 second but then it tries to render the <template> of Comp.vue using the data that might not even exist (because it appears in setup after throwing error).
And even if it manages to render <template> correctly, it still does not trigger onErrorCaptured in App.vue and do not switch to show error message.
Any additional comments?
I am building a custom rendering package built on top of Vue and it heavily uses structures like these:
// Wrappers are supposed to catch ALL errors and throws in child <Block /> and show nice error message
<BlockWrapper>
<Block ... />
</BlockWrapper>
<BlockWrapper>
<Block ... />
</BlockWrapper>
<BlockWrapper>
<Block ... />
</BlockWrapper>
...Because of this bug OR my misunderstanding of how to handle async errors in Vue 3, even when thrown it still tries to render child block's <template> even with missing data (because setup is stopped executing), throws on reading properties of non-existing objects and the whole Nuxt page breaks.
Please, don't tell me this is a no-fix. It would be a disaster... π