Subscribe on changes!

Current instance is not unset after rendering error on SSR

avatar
Jun 14th 2022

Vue version

3.2.37

Link to minimal reproduction

https://stackblitz.com/edit/github-qw7apw

Steps to reproduce

Click 'Trigger error'. It will try to load a component where there is a JS error.

Then click 'click here to see stale instance' - it will perform a hard reload, calling getCurrentInstance() on the server and revealing that the instance was not unset.

What is expected?

I expect the current component instance to be unset if there is a rendering error.

What is actually happening?

When there is a vue rendering error, the current component instance is not unset.

System Info

No response

Any additional comments?

In Nuxt we were relying on getCurrentInstance to return null if called outside of a Vue lifecycle. See https://github.com/nuxt/nuxt.js/issues/14112.

avatar
Sep 6th 2022

+1