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

onUnmounted doesn't run if slot content is wrapped in a div (within this tab structure) #11168

Closed
shawnyama opened this issue Jun 18, 2024 · 0 comments · Fixed by #11171
Closed

Comments

@shawnyama
Copy link

shawnyama commented Jun 18, 2024

Vue version

3.3.13

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-wdnvx3?file=src%2FApp.vue

Steps to reproduce

  1. Switch from Tab 2 to Tab 1
  2. Switch from Tab 1 to Tab 2
  3. Notice how the onUnmounted message from Child.vue doesn't run when switching from Tab 2 to Tab 1 but does work when switching from Tab 1 to Tab 2
  4. There is a Hide/Show content button that you can use if you want a way to unmount everything (optional)

What is expected?

My Child.vue is supposed to print the description prop passed to it onUnmounted. When I switch from Tab 2 to Tab 1 the Child.vue in Tab 2 should print its onUnmounted message. The message is: UNMOUNTING CHILD IN DIV IN WRAPPER.

What is actually happening?

My Child.vue within my Tab 2 does not print its onUnmounted message when I switch tabs. This seems to be due to it being wrapped in a div, since Tab 1's onUnmounted does run while not wrapped in a div. I don't see why wrapping the <child> with a div would negate its onUnmounted call.

System Info

macOS Sonoma 14.5
Node.js v18.18.2
npm 9.8.1

Any additional comments?

No response

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant