]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(suspense): should discard unmount effects of invalidated pending branch
authorEvan You <yyx990803@gmail.com>
Fri, 18 Sep 2020 03:49:06 +0000 (23:49 -0400)
committerEvan You <yyx990803@gmail.com>
Fri, 18 Sep 2020 03:49:06 +0000 (23:49 -0400)
packages/runtime-core/__tests__/components/Suspense.spec.ts
packages/runtime-core/src/components/Suspense.ts

index dd7d67bc909bf818be94acdcb0689ae39d332120..c6ab0f3fa327c08c9430cce3fc2d7df0467f3a1a 100644 (file)
@@ -380,8 +380,8 @@ describe('Suspense', () => {
     await Promise.all(deps)
     await nextTick()
     expect(serializeInner(root)).toBe(`<!---->`)
-    // should discard effects (except for unmount)
-    expect(calls).toEqual(['unmounted'])
+    // should discard effects
+    expect(calls).toEqual([])
   })
 
   test('unmount suspense after resolve', async () => {
index 16204b6d0e002f3257c888460f9309ce3f6f28b5..288139609a90bf3f8163bcfed792ded0c7648641 100644 (file)
@@ -201,11 +201,12 @@ function patchSuspense(
         suspense.isHydrating = false
         suspense.activeBranch = pendingBranch
       } else {
-        unmount(pendingBranch, parentComponent, null)
+        unmount(pendingBranch, parentComponent, suspense)
       }
       // increment pending ID. this is used to invalidate async callbacks
       // reset suspense state
       suspense.deps = 0
+      // discard effects from pending branch
       suspense.effects.length = 0
       // discard previous container
       suspense.hiddenContainer = createElement('div')