Wait for all modules to load
This commit is contained in:
parent
ddb035e418
commit
b33af58147
|
@ -221,5 +221,4 @@ const showSetInstanceModal = ref(false)
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@import "style/_main";
|
@import "style/_main";
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import logger from '~/logging'
|
import logger from '~/logging'
|
||||||
import App from '~/App.vue'
|
|
||||||
import router from '~/router'
|
import router from '~/router'
|
||||||
import VueLazyload from 'vue-lazyload'
|
import VueLazyload from 'vue-lazyload'
|
||||||
import store from '~/store'
|
import store from '~/store'
|
||||||
|
@ -15,21 +14,36 @@ sync(store, router)
|
||||||
const app = createApp({
|
const app = createApp({
|
||||||
store,
|
store,
|
||||||
router,
|
router,
|
||||||
render: (h: CreateElement) => h(App)
|
data: () => ({ isMounted: false }),
|
||||||
|
async mounted () {
|
||||||
|
this.isMounted = true
|
||||||
|
},
|
||||||
|
render (h: CreateElement) {
|
||||||
|
if (this.isMounted) {
|
||||||
|
return import('~/App.vue')
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO (wvffle): Import fake app component
|
||||||
|
return h()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
app.use(VueCompositionAPI)
|
app.use(VueCompositionAPI)
|
||||||
app.use(VueLazyload)
|
app.use(VueLazyload)
|
||||||
|
|
||||||
|
const modules: Promise<unknown>[] = []
|
||||||
for (const module of Object.values(import.meta.globEager('./modules/*.ts'))) {
|
for (const module of Object.values(import.meta.globEager('./modules/*.ts'))) {
|
||||||
module.install?.({
|
modules.push(module.install?.({
|
||||||
app,
|
app,
|
||||||
router,
|
router,
|
||||||
store
|
store
|
||||||
})
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
store.dispatch('instance/fetchFrontSettings').finally(() => {
|
store.dispatch('instance/fetchFrontSettings').finally(async () => {
|
||||||
|
// Wait for all modules to load
|
||||||
|
await Promise.all(modules)
|
||||||
|
|
||||||
app.mount('#app')
|
app.mount('#app')
|
||||||
logger.default.info('Everything loaded!')
|
logger.default.info('Everything loaded!')
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue