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 <div
id="app-loaded" id="app-loaded"
:style="bgStyle" :style="bgStyle"
v-show="$store.state.interface.themeApplied"
> >
<div <div
id="app_bg_wrapper" id="app_bg_wrapper"

View File

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

View File

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

View File

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

View File

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