-
-
Notifications
You must be signed in to change notification settings - Fork 8.9k
fix(suspense): defer clearing fallback vnode el in case it has dirs #14080
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
base: main
Are you sure you want to change the base?
Conversation
…unt active branch first
WalkthroughDefers clearing of Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as Application
participant Suspense as Suspense
participant Renderer as Renderer
participant PostRender as Post-Render Queue
rect rgb(248,249,255)
note over Suspense,Renderer: Before (synchronous)
App->>Suspense: resolve async branch / unmount active branch
Suspense->>Renderer: clear vnode.ssFallback.el (immediate)
Renderer->>Renderer: continue render
end
rect rgb(240,255,240)
note over Suspense,PostRender: After (deferred)
App->>Suspense: resolve async branch / unmount active branch
Suspense->>PostRender: queuePostRenderEffect(clear vnode.ssFallback.el, suspense)
Suspense->>Renderer: continue render
PostRender->>Suspense: run queued effect after render -> clear vnode.ssFallback.el
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested labels
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
Size ReportBundles
Usages
|
@vue/compiler-core
@vue/compiler-dom
@vue/compiler-sfc
@vue/compiler-ssr
@vue/reactivity
@vue/runtime-core
@vue/runtime-dom
@vue/server-renderer
@vue/shared
vue
@vue/compat
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
packages/runtime-core/src/components/Suspense.ts (1)
583-587: LGTM: Cleanup correctly deferred for non-transition case.This appropriately defers the fallback vnode
elcleanup for the case when there's no delayed transition (!delayEnter). The conditions are mutually exclusive with the first clear (lines 557-561), ensuring the cleanup happens exactly once via the appropriate code path.Minor observation: The comment on line 582 mentions "only clear immediately" but the implementation now correctly defers to post-render. The comment could be updated to reflect this, though the code itself is correct.
Consider updating the comment to reflect the deferred execution:
- // clear el reference from fallback vnode to allow GC - // only clear immediately if there's no delayed transition + // clear el reference from fallback vnode to allow GC after render + // only clear if there's no delayed transition (handled in afterLeave callback otherwise)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/runtime-core/src/components/Suspense.ts(3 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/runtime-core/src/components/Suspense.ts (1)
packages/runtime-core/src/renderer.ts (1)
queuePostRenderEffect(287-296)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: test / e2e-test
🔇 Additional comments (2)
packages/runtime-core/src/components/Suspense.ts (2)
23-23: LGTM: Import addition is correct.The
queuePostRenderEffectimport is necessary for deferring the fallback vnode cleanup to the post-render phase, which addresses the null reference timing issue.
557-561: LGTM: Cleanup correctly deferred for transition case.This properly defers clearing the fallback vnode's
elreference until after the render phase completes. By scheduling the cleanup inqueuePostRenderEffectwithin the transition'safterLeavecallback, the element reference remains available throughout the transition and render operations, preventing the null reference error reported in issue #14078.
|
/ecosystem-ci run |
|
📝 Ran ecosystem CI: Open
|
close #14078
issue playground
playground with this pr
Summary by CodeRabbit
Bug Fixes
Tests