bootstrap-vue
bootstrap-vue copied to clipboard
Modal lazy loading and defineAsyncComponent
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]
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?