Subscribe on changes!

Suspense emits `fallback` but does not displays the slot when using a transition

avatar
Jun 16th 2021

Version

3.1.1

Reproduction link

SFC Playground

Steps to reproduce

  1. Click on toggle

What is expected?

The fallback content should be displayed

What is actually happening?

It's not


  • The fallback event seems to be correctly emitted
avatar
Jun 16th 2021

As a workaround it's possible to add a v-else case:

<Suspense>
      <template #default>
        <component v-if="Component" :is="Component" />
        <span v-else></span>
      </template>
      <template #fallback>
        <p>Loading...</p>
      </template>
    </Suspense>
avatar
Jun 16th 2021
      if (delayEnter) {
+       suspense.isInFallback = true
        activeBranch!.transition!.afterLeave = mountFallback
      }
      // unmount current active branch
      unmount(
        activeBranch!,
        parentComponent,
        null, // no suspense so unmount hooks fire now
        true // shouldRemove
      )

will works fine.