]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): ensure suspense creates dep component's render effect with correct...
authorThorsten Lünborg <t.luenborg@googlemail.com>
Fri, 31 May 2024 15:57:37 +0000 (17:57 +0200)
committerGitHub <noreply@github.com>
Fri, 31 May 2024 15:57:37 +0000 (23:57 +0800)
close #7688

packages/runtime-core/src/components/Suspense.ts
packages/runtime-core/src/renderer.ts

index 5914e891cb2381f7750c3e36b73200b0537aa422..7c3c75a6fe716f8ba84824cd4d5b26c7444e8778 100644 (file)
@@ -438,6 +438,7 @@ export interface SuspenseBoundary {
   registerDep(
     instance: ComponentInternalInstance,
     setupRenderEffect: SetupRenderEffectFn,
+    optimized: boolean,
   ): void
   unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void
 }
@@ -679,7 +680,7 @@ function createSuspenseBoundary(
       return suspense.activeBranch && next(suspense.activeBranch)
     },
 
-    registerDep(instance, setupRenderEffect) {
+    registerDep(instance, setupRenderEffect, optimized) {
       const isInPendingSuspense = !!suspense.pendingBranch
       if (isInPendingSuspense) {
         suspense.deps++
index c7dfbf45dd220e6c8c82e2a4c8b63e9e8686b555..542341b13e8f5add69e47f976aea54aecad20475 100644 (file)
@@ -1238,7 +1238,8 @@ function baseCreateRenderer(
     // setup() is async. This component relies on async logic to be resolved
     // before proceeding
     if (__FEATURE_SUSPENSE__ && instance.asyncDep) {
-      parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect)
+      parentSuspense &&
+        parentSuspense.registerDep(instance, setupRenderEffect, optimized)
 
       // Give it a placeholder if this is not hydration
       // TODO handle self-defined fallback