aboutsummaryrefslogtreecommitdiff
path: root/src/boot/after_store.js
diff options
context:
space:
mode:
authorHJ <30-hj@users.noreply.git.pleroma.social>2024-05-22 12:15:21 +0000
committerHJ <30-hj@users.noreply.git.pleroma.social>2024-05-22 12:15:21 +0000
commit3128ea57e1f0281d4d8f94d868de10b5b97663af (patch)
tree69c3c02109dbd502b9daf5d11b0103d550d767f7 /src/boot/after_store.js
parent3056017f8e35c98a7fb42162c7e3460a4ebab619 (diff)
parent6ea69eb51a480e3ab81a69b99f92165fc97f8177 (diff)
Merge branch 'themes3-cache' into 'develop'
implement a simple caching system for themes 3 See merge request pleroma/pleroma-fe!1911
Diffstat (limited to 'src/boot/after_store.js')
-rw-r--r--src/boot/after_store.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/boot/after_store.js b/src/boot/after_store.js
index bfb671ed..bcab7a66 100644
--- a/src/boot/after_store.js
+++ b/src/boot/after_store.js
@@ -14,7 +14,7 @@ import { windowWidth, windowHeight } from '../services/window_utils/window_utils
import { getOrCreateApp, getClientToken } from '../services/new_api/oauth.js'
import backendInteractorService from '../services/backend_interactor_service/backend_interactor_service.js'
import { CURRENT_VERSION } from '../services/theme_data/theme_data.service.js'
-import { applyTheme, applyConfig } from '../services/style_setter/style_setter.js'
+import { applyTheme, applyConfig, tryLoadCache } from '../services/style_setter/style_setter.js'
import FaviconService from '../services/favicon_service/favicon_service.js'
import { initServiceWorker, updateFocus } from '../services/sw/sw.js'
@@ -353,21 +353,25 @@ const afterStoreSetup = async ({ store, i18n }) => {
await setConfig({ store })
- const { customTheme, customThemeSource } = store.state.config
+ const { customTheme, customThemeSource, forceThemeRecompilation } = store.state.config
const { theme } = store.state.instance
const customThemePresent = customThemeSource || customTheme
- if (customThemePresent) {
- if (customThemeSource && customThemeSource.themeEngineVersion === CURRENT_VERSION) {
- applyTheme(customThemeSource)
- } else {
- applyTheme(customTheme)
- }
+ if (!forceThemeRecompilation && tryLoadCache()) {
store.commit('setThemeApplied')
- } else if (theme) {
- // do nothing, it will load asynchronously
} else {
- console.error('Failed to load any theme!')
+ if (customThemePresent) {
+ if (customThemeSource && customThemeSource.themeEngineVersion === CURRENT_VERSION) {
+ applyTheme(customThemeSource)
+ } else {
+ applyTheme(customTheme)
+ }
+ store.commit('setThemeApplied')
+ } else if (theme) {
+ // do nothing, it will load asynchronously
+ } else {
+ console.error('Failed to load any theme!')
+ }
}
applyConfig(store.state.config)