File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1996,7 +1996,7 @@ function baseCreateRenderer(
19961996 const anchor =
19971997 nextIndex + 1 < l2
19981998 ? // #13559, fallback to el placeholder for unresolved async component
1999- anchorVNode . el || anchorVNode . placeholder
1999+ anchorVNode . el || resolveAsyncComponentPlaceholder ( anchorVNode )
20002000 : parentAnchor
20012001 if ( newIndexToOldIndexMap [ i ] === 0 ) {
20022002 // mount new
@@ -2577,3 +2577,26 @@ export function invalidateMount(hooks: LifecycleHook): void {
25772577 hooks [ i ] . flags ! |= SchedulerJobFlags . DISPOSED
25782578 }
25792579}
2580+
2581+ function resolveAsyncComponentPlaceholder ( anchorVnode : VNode ) {
2582+ // anchor vnode is a unresolved async component
2583+ if ( anchorVnode . placeholder ) {
2584+ return anchorVnode . placeholder
2585+ }
2586+
2587+ // anchor vnode maybe is a wrapper component has single unresolved async component
2588+ const asyncWrapper = anchorVnode . component
2589+ if ( asyncWrapper ) {
2590+ const subTree = asyncWrapper . subTree
2591+
2592+ // wrapper that directly contains an unresolved async component
2593+ if ( subTree . placeholder ) {
2594+ return subTree . placeholder
2595+ }
2596+
2597+ // try to locate deeper nested async component placeholder
2598+ return resolveAsyncComponentPlaceholder ( subTree )
2599+ }
2600+
2601+ return null
2602+ }
You can’t perform that action at this time.
0 commit comments