Skip to content

Commit

Permalink
fix(runtime-core): ensure suspense creates dep component's render eff…
Browse files Browse the repository at this point in the history
…ect with correct optimized flag (#7689)

close #7688
  • Loading branch information
LinusBorg committed May 31, 2024
1 parent c73847f commit c521f95
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/runtime-core/src/components/Suspense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ export interface SuspenseBoundary {
registerDep(
instance: ComponentInternalInstance,
setupRenderEffect: SetupRenderEffectFn,
optimized: boolean,
): void
unmount(parentSuspense: SuspenseBoundary | null, doRemove?: boolean): void
}
Expand Down Expand Up @@ -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++
Expand Down
3 changes: 2 additions & 1 deletion packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c521f95

Please sign in to comment.