mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2026-01-03 11:34:54 +01:00
Fix flash of wrong theme on initial UI load (#485)
Co-authored-by: Tonya <tonya@tokia.dev>
This commit is contained in:
@@ -20,6 +20,12 @@ export default defineNuxtConfig({
|
||||
},
|
||||
},
|
||||
|
||||
app: {
|
||||
head: {
|
||||
script: [{ src: "/set-theme.js" }],
|
||||
},
|
||||
},
|
||||
|
||||
css: ["@/assets/css/main.css"],
|
||||
|
||||
pwa: {
|
||||
|
||||
9
frontend/public/set-theme.js
Normal file
9
frontend/public/set-theme.js
Normal file
@@ -0,0 +1,9 @@
|
||||
try {
|
||||
console.log('Setting theme');
|
||||
const theme = JSON.parse(
|
||||
localStorage.getItem('homebox/preferences/location')
|
||||
).theme;
|
||||
if (theme) document.documentElement.setAttribute('data-theme', theme);
|
||||
} catch (e) {
|
||||
console.error('Failed to set theme', e);
|
||||
}
|
||||
Reference in New Issue
Block a user