Subscribe on changes!

Suspense emit are inconsistent with non Async children on the initial render

avatar
Feb 8th 2022

Version

3.2.30

Reproduction link

sfc.vuejs.org/

Steps to reproduce

  • Open the link

What is expected?

  • To have pending and resolve events like when the component is async as it happens when switching between components

What is actually happening?

  • Only resolve is emitted on the initial render

Since suspense can be used with both async and sync components, I think we need some consistent event emitting:

  • Either emit both pending and resolve with sync components
  • Emit a different event to know a component is being displayed

The idea is being able to know that Suspense is displaying something and handle with the same code async and sync children. This could be useful for the router to know when view components start loading and when they are done loading. At the end there should be the same amount of pending and resolve (or errors or any other event)