Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
funkwhale
funkwhale
Commits
41edd42b
Commit
41edd42b
authored
Apr 18, 2022
by
Kasper Seweryn
🥞
Committed by
Kasper Seweryn
Jul 03, 2022
Browse files
Wait for all modules to load
parent
1dc6e179
Changes
2
Hide whitespace changes
Inline
Side-by-side
front/src/App.vue
View file @
41edd42b
...
...
@@ -221,5 +221,4 @@ const showSetInstanceModal = ref(false)
<
style
lang=
"scss"
>
@import
"style/_main"
;
</
style
>
front/src/main.ts
View file @
41edd42b
import
logger
from
'
~/logging
'
import
App
from
'
~/App.vue
'
import
router
from
'
~/router
'
import
VueLazyload
from
'
vue-lazyload
'
import
store
from
'
~/store
'
...
...
@@ -15,21 +14,36 @@ sync(store, router)
const
app
=
createApp
({
store
,
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
(
VueLazyload
)
const
modules
:
Promise
<
unknown
>
[]
=
[]
for
(
const
module
of
Object
.
values
(
import
.
meta
.
globEager
(
'
./modules/*.ts
'
)))
{
module
.
install
?.({
modules
.
push
(
module
.
install
?.({
app
,
router
,
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
'
)
logger
.
default
.
info
(
'
Everything loaded!
'
)
})
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment