File tree Expand file tree Collapse file tree 2 files changed +61
-1
lines changed
runtime-core/src/components Expand file tree Collapse file tree 2 files changed +61
-1
lines changed Original file line number Diff line number Diff line change @@ -566,7 +566,7 @@ function createSuspenseBoundary(
566566 // (got `pendingBranch.el`).
567567 // Therefore, after the mounting of activeBranch is completed,
568568 // it is necessary to get the latest anchor.
569- if ( parentNode ( activeBranch . el ! ) !== suspense . hiddenContainer ) {
569+ if ( parentNode ( activeBranch . el ! ) === container ) {
570570 anchor = next ( activeBranch )
571571 }
572572 unmount ( activeBranch , parentComponent , suspense , true )
Original file line number Diff line number Diff line change @@ -2162,6 +2162,66 @@ describe('e2e: Transition', () => {
21622162 } ,
21632163 E2E_TIMEOUT ,
21642164 )
2165+
2166+ // #11806
2167+ test (
2168+ 'switch between Async and Sync child when transition is not finished' ,
2169+ async ( ) => {
2170+ await page ( ) . evaluate ( ( ) => {
2171+ const { createApp, shallowRef, h, nextTick } = ( window as any ) . Vue
2172+ createApp ( {
2173+ template : `
2174+ <div id="container">
2175+ <Transition mode="out-in">
2176+ <Suspense>
2177+ <component :is="view"/>
2178+ </Suspense>
2179+ </Transition>
2180+ </div>
2181+ <button id="toggleBtn" @click="click">button</button>
2182+ ` ,
2183+ setup : ( ) => {
2184+ const view = shallowRef ( 'SyncB' )
2185+ const click = async ( ) => {
2186+ view . value = 'SyncA'
2187+ await nextTick ( )
2188+ view . value = 'AsyncB'
2189+ await nextTick ( )
2190+ view . value = 'SyncB'
2191+ }
2192+ return { view, click }
2193+ } ,
2194+ components : {
2195+ SyncA : {
2196+ setup ( ) {
2197+ return ( ) => h ( 'div' , 'SyncA' )
2198+ } ,
2199+ } ,
2200+ AsyncB : {
2201+ async setup ( ) {
2202+ await nextTick ( )
2203+ return ( ) => h ( 'div' , 'AsyncB' )
2204+ } ,
2205+ } ,
2206+ SyncB : {
2207+ setup ( ) {
2208+ return ( ) => h ( 'div' , 'SyncB' )
2209+ } ,
2210+ } ,
2211+ } ,
2212+ } ) . mount ( '#app' )
2213+ } )
2214+
2215+ expect ( await html ( '#container' ) ) . toBe ( '<div>SyncB</div>' )
2216+
2217+ await click ( '#toggleBtn' )
2218+ await nextFrame ( )
2219+ await transitionFinish ( )
2220+ await transitionFinish ( )
2221+ expect ( await html ( '#container' ) ) . toBe ( '<div class="">SyncB</div>' )
2222+ } ,
2223+ E2E_TIMEOUT ,
2224+ )
21652225 } )
21662226
21672227 describe ( 'transition with Teleport' , ( ) => {
You can’t perform that action at this time.
0 commit comments