Subscribe on changes!

defineAsyncComponent delay is effect

avatar
Nov 20th 2023

Vue version

3.3.4

Steps to reproduce

  • in setup
  const EntryAnalysis = defineAsyncComponent({
    loader: () => import('./components/entry-analysis/EntryAnalysis.vue'),
    loadingComponent: PanelLoading,
    delay: 5000,
    timeout: 120000,
  })
  • template
<button @click="visible = true">open</button>

<Suspense v-if="visible">
  <template #default>
        <EntryAnalysis></EntryAnalysis>
        </template>
        <template #fallback>
          <p> Loading... </p>
  </template>

</Suspense>

What is expected?

component render after 5s

What is actually happening?

defineAsyncComponent delay is lose efficacy, it Immediately displayed

System Info

No response

Any additional comments?

No response

avatar
Nov 20th 2023

delay does not delay the rendering of the component. it delays the rendering of the loadingComponent while the component is still being fetched.

https://vuejs.org/guide/components/async.html#loading-and-error-states