parent
							
								
									08e93220f1
								
							
						
					
					
						commit
						43e2a72900
					
				@ -551,6 +551,8 @@ function createSuspenseBoundary(
 | 
				
			|||||||
      if (delayEnter) {
 | 
					      if (delayEnter) {
 | 
				
			||||||
        activeBranch!.transition!.afterLeave = mountFallback
 | 
					        activeBranch!.transition!.afterLeave = mountFallback
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					      suspense.isInFallback = true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      // unmount current active branch
 | 
					      // unmount current active branch
 | 
				
			||||||
      unmount(
 | 
					      unmount(
 | 
				
			||||||
        activeBranch!,
 | 
					        activeBranch!,
 | 
				
			||||||
@ -559,7 +561,6 @@ function createSuspenseBoundary(
 | 
				
			|||||||
        true // shouldRemove
 | 
					        true // shouldRemove
 | 
				
			||||||
      )
 | 
					      )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      suspense.isInFallback = true
 | 
					 | 
				
			||||||
      if (!delayEnter) {
 | 
					      if (!delayEnter) {
 | 
				
			||||||
        mountFallback()
 | 
					        mountFallback()
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
				
			|||||||
@ -1325,6 +1325,69 @@ describe('e2e: Transition', () => {
 | 
				
			|||||||
      },
 | 
					      },
 | 
				
			||||||
      E2E_TIMEOUT
 | 
					      E2E_TIMEOUT
 | 
				
			||||||
    )
 | 
					    )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    // #3963
 | 
				
			||||||
 | 
					    test(
 | 
				
			||||||
 | 
					      'Suspense fallback should work with transition',
 | 
				
			||||||
 | 
					      async () => {
 | 
				
			||||||
 | 
					        await page().evaluate(() => {
 | 
				
			||||||
 | 
					          const { createApp, shallowRef, h } = (window as any).Vue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          const One = {
 | 
				
			||||||
 | 
					            template: `<div>{{ msg }}</div>`,
 | 
				
			||||||
 | 
					            setup() {
 | 
				
			||||||
 | 
					              return new Promise(_resolve => {
 | 
				
			||||||
 | 
					                // @ts-ignore
 | 
				
			||||||
 | 
					                window.resolve = () =>
 | 
				
			||||||
 | 
					                  _resolve({
 | 
				
			||||||
 | 
					                    msg: 'success'
 | 
				
			||||||
 | 
					                  })
 | 
				
			||||||
 | 
					              })
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					          createApp({
 | 
				
			||||||
 | 
					            template: `
 | 
				
			||||||
 | 
					              <div id="container">
 | 
				
			||||||
 | 
					                <transition mode="out-in">
 | 
				
			||||||
 | 
					                  <Suspense :timeout="0">
 | 
				
			||||||
 | 
					                    <template #default>
 | 
				
			||||||
 | 
					                      <component :is="view" />
 | 
				
			||||||
 | 
					                    </template>
 | 
				
			||||||
 | 
					                    <template #fallback>
 | 
				
			||||||
 | 
					                      <div>Loading...</div>
 | 
				
			||||||
 | 
					                    </template>
 | 
				
			||||||
 | 
					                  </Suspense>
 | 
				
			||||||
 | 
					                </transition>
 | 
				
			||||||
 | 
					              </div>
 | 
				
			||||||
 | 
					              <button id="toggleBtn" @click="click">button</button>
 | 
				
			||||||
 | 
					            `,
 | 
				
			||||||
 | 
					            setup: () => {
 | 
				
			||||||
 | 
					              const view = shallowRef(null)
 | 
				
			||||||
 | 
					              const click = () => {
 | 
				
			||||||
 | 
					                view.value = view.value ? null : h(One)
 | 
				
			||||||
 | 
					              }
 | 
				
			||||||
 | 
					              return { view, click }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					          }).mount('#app')
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        expect(await html('#container')).toBe('<!---->')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await click('#toggleBtn')
 | 
				
			||||||
 | 
					        await nextFrame()
 | 
				
			||||||
 | 
					        expect(await html('#container')).toBe('<div class="">Loading...</div>')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await page().evaluate(() => {
 | 
				
			||||||
 | 
					          // @ts-ignore
 | 
				
			||||||
 | 
					          window.resolve()
 | 
				
			||||||
 | 
					        })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        await transitionFinish(duration * 2)
 | 
				
			||||||
 | 
					        expect(await html('#container')).toBe('<div class="">success</div>')
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      E2E_TIMEOUT
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  describe('transition with v-show', () => {
 | 
					  describe('transition with v-show', () => {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user