core
core copied to clipboard
fix(Suspense): switch suspense cause error in the Keepalive (fix: #6416)
Fixes #6416 I wrote a test case to replicate the bug in Suspense.spec.ts。
This bug occurs for two reasons
- One is pendingId , pendingId controls whether to render pendingBranch or not .so we need to reduce pendingId sometimes.
- In Function setActiveBranch, sometimes,branch.el is null,it overlay suspense.vnode.el, cause suspense.vnode.el missing.Finally,it will cause parent misiing in Function parentNode
- but this bug still alive in some case...
function setActiveBranch(suspense: SuspenseBoundary, branch: VNode) {
suspense.activeBranch = branch
const { vnode, parentComponent } = suspense
const el = (vnode.el = branch.el) //sometime,branch.el is null
if (parentComponent && parentComponent.subTree === vnode) {
//...
}
}
Here's a video demo of the fix: https://www.bilibili.com/video/BV1Cd4y1R7bU/ and SFC Playground demo of this fix:my demo
this seems not to fix #6463. see demo with your deploy preview
this seems not to fix #6463. see demo with your deploy preview
yes...I misunderstood the difference between #6416 and #6463,seem my pr only fix #6416, Here's a video demo of the fix: https://www.bilibili.com/video/BV1Cd4y1R7bU/ and SFC Playground demo of this fix:my demo
Hello, any progress with this PR? Need any help?
Hello, any progress with this PR? Need any help?
Thank you for your kindness!, but this PR should be suspended first as the reason for this bug is complex,I think it needs further study。
Thanks for the PR - although this isn't the correct fix, I reused your test case in aa0c13f63