core icon indicating copy to clipboard operation
core copied to clipboard

fix(Suspense): switch suspense cause error in the Keepalive (fix: #6416)

Open moushicheng opened this issue 2 years ago • 4 comments

Fixes #6416 I wrote a test case to replicate the bug in Suspense.spec.ts。

This bug occurs for two reasons

  1. One is pendingId , pendingId controls whether to render pendingBranch or not .so we need to reduce pendingId sometimes.
  2. 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
  3. 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

moushicheng avatar Aug 13 '22 08:08 moushicheng

this seems not to fix #6463. see demo with your deploy preview

edison1105 avatar Aug 18 '22 04:08 edison1105

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

moushicheng avatar Aug 18 '22 06:08 moushicheng

Hello, any progress with this PR? Need any help?

mefcorvi avatar Sep 27 '22 21:09 mefcorvi

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。

moushicheng avatar Sep 29 '22 08:09 moushicheng

Thanks for the PR - although this isn't the correct fix, I reused your test case in aa0c13f63

yyx990803 avatar Dec 12 '23 15:12 yyx990803