bootstrap-vue icon indicating copy to clipboard operation
bootstrap-vue copied to clipboard

Modal lazy loading and defineAsyncComponent

Open amokrunner opened this issue 3 years ago • 1 comments

Describe the bug

Components defined using the composition API

Steps to reproduce the bug

<script setup>
const MyComponent = defineAsyncComponent(() => import('./MyComponent'))
...
</script>

<template>
  <b-modal
      ref="modal"
      centered
    >
    <my-component />
  </b-modal>
</template>

Expected behavior

When watching network activity in developer console, I would expect not to see the component load until the modal is shown.

Versions

Libraries:

  • BootstrapVue: 2.23.1
  • Bootstrap: 4.6.2
  • Vue: 2.7.14

Environment:

  • Device: PC
  • OS: Window 11
  • Browser: Chrome
  • Version: [e.g. 70]

amokrunner avatar Nov 20 '22 04:11 amokrunner

I believe b-modal is loaded eagerly and slot content is evaluated on initial render, even if you haven't "shown" it to the user. Are you saying you notice a difference from 2.22/vue2? If you wrap my-component in a div v-if=false do you notice it is lazy loaded once set to true?

darrinmn9 avatar Dec 09 '22 14:12 darrinmn9