content icon indicating copy to clipboard operation
content copied to clipboard

Vue Components rendered within Content file via SSR do not have `onUnmounted` events called with Vue 3.5

Open GerryWilko opened this issue 1 year ago • 0 comments

Environment

  • Operating System: Darwin
  • Node Version: v20.17.0
  • Nuxt Version: 3.13.2
  • CLI Version: 3.14.0
  • Nitro Version: 2.9.7
  • Package Manager: [email protected]
  • Builder: -
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

https://github.com/GerryWilko/unmount-repro

This repro has an index page and a test page with the same content md file rendered on them note the logs of the mounted unmounted calls for each.

Turning off SSR or downgrading to Vue 3.4 resolves the issue in this reproduction.

Describe the bug

I seem to have encountered a strange issue related to the upgrade to Vue 3.5.

When using the unmounted Vue lifecycle hooks in a component that is rendered within a markdown file we are no longer seeing the unmounted hooks called.

Here is a simple set of logs demonstrating the issue:

Vue 3.5 (no unmounted)

Image

Vue 3.4 (unmounted called)

Image

Note in Vue 3.4 we have both mounted and unmounted calls. In Vue 3.5 we are missing the unmounted call from the component but we do have it from the wrapping page being unmounted.

I believe it may be something to do with the ContentRenderer not unmounting from the SSR. All subsequent non-SSR mount and unmounting of the component work fine but the initial SSR component never seems to have its unmounted lifecycle hooks called on Vue 3.5.

Additional context

No response

Logs

No response

GerryWilko avatar Oct 18 '24 14:10 GerryWilko