only show interface after theme has been applied

This commit is contained in:
Henry Jameson 2024-04-03 22:52:12 +03:00
parent e8159164e3
commit 9806eea12e
5 changed files with 7 additions and 5 deletions

View File

@ -2,6 +2,7 @@
<div
id="app-loaded"
:style="bgStyle"
v-show="$store.state.interface.themeApplied"
>
<div
id="app_bg_wrapper"

View File

@ -363,6 +363,7 @@ const afterStoreSetup = async ({ store, i18n }) => {
} else {
applyTheme(customTheme)
}
store.commit('setThemeApplied')
} else if (theme) {
// do nothing, it will load asynchronously
} else {

View File

@ -386,6 +386,7 @@ const instance = {
} else {
applyTheme(themeData.theme)
}
commit('setThemeApplied')
})
},
fetchEmoji ({ dispatch, state }) {

View File

@ -1,4 +1,5 @@
const defaultState = {
themeApplied: false,
settingsModalState: 'hidden',
settingsModalLoadedUser: false,
settingsModalLoadedAdmin: false,
@ -35,6 +36,9 @@ const interfaceMod = {
state.settings.currentSaveStateNotice = { error: true, errorData: error }
}
},
setThemeApplied (state) {
state.themeApplied = true
},
setNotificationPermission (state, permission) {
state.notificationPermission = permission
},

View File

@ -88,9 +88,6 @@ export const generateTheme = async (input, callbacks) => {
}
export const applyTheme = async (input) => {
const body = document.body
body.classList.add('hidden')
const styleSheet = new CSSStyleSheet()
document.adoptedStyleSheets = [styleSheet]
@ -103,8 +100,6 @@ export const applyTheme = async (input) => {
}
)
body.classList.remove('hidden')
setTimeout(lazyProcessFunc, 0)
return Promise.resolve()