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

fix(Suspense): avoid unmount activeBranch twice if wrapped in transition #9392

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

edison1105
Copy link
Member

@edison1105 edison1105 commented Oct 13, 2023

close #7966
the root cause is that the suspense resolves before the fallback node is mounted. This caused component B to be unmounted twice, causing this issue when it was unmounted the second time. see simplified demo
Notice the Console, unmount was printed twice.

@github-actions
Copy link

github-actions bot commented Oct 13, 2023

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.2 kB (+83 B) 34.6 kB (+19 B) 31.1 kB (-4 B)
vue.global.prod.js 147 kB (+83 B) 54 kB (+20 B) 48.1 kB (+24 B)

Usages

Name Size Gzip Brotli
createApp 49.6 kB 19.5 kB 17.8 kB
createSSRApp 53.2 kB 20.9 kB 19.1 kB
defineCustomElement 51.9 kB 20.2 kB 18.5 kB
overall 63.2 kB (+83 B) 24.5 kB (+25 B) 22.3 kB (+55 B)

@pikax
Copy link
Member

pikax commented Oct 13, 2023

@edison1105 I don't think the solution is good enough, from what I could gather this is caused by the renderer.ts

Basically the unmount is being called multiple times on the vnode, I wonder if we could replace the condition on suspense with a non altering flag on suspense.

I suppose it would make sense the vnode to know it has been unmounted therefore if unmounted is called again it should be ignored, some input from @yyx990803 would be great :)

@edison1105
Copy link
Member Author

@pikax
That's a great idea. I changed the solution.

chore: improve code

chore: improve code

chore: improve code

chore(deps): update dependency @types/node to v18 (vuejs#9323)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

chore: improve code

chore: revert code

chore: improve code
@edison1105
Copy link
Member Author

/ecosystem-ci run

@vue-bot
Copy link
Contributor

vue-bot commented Apr 16, 2024

📝 Ran ecosystem CI: Open

suite result latest scheduled
language-tools success success
nuxt success success
pinia success failure
quasar success success
radix-vue success success
router success success
test-utils success success
vant success success
vite-plugin-vue success success
vitepress success success
vue-i18n success success
vue-macros success success
vuetify failure success
vueuse success success
vue-simple-compiler success success

@edison1105 edison1105 added the ready for review This PR requires more reviews label Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready for review This PR requires more reviews scope: suspense
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

App crashes when using router-view, transition, suspense and teleport
3 participants