Skip to content

Commit

Permalink
fix(ui): ensure theme is in sync with local storage to prevent flicke…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
robertsLando committed Oct 30, 2023
1 parent 8f00446 commit 6ad4d0d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,10 @@ export default {
if (settings.load('dark') === undefined) {
useBaseStore().setDarkMode(systemThemeDark)
} else {
// default to white
// load the theme from localstorage
// this is needed to prevent the theme switch on load
// this will be overriden by settings value once `initSettings`
// base store method is called
this.$vuetify.theme.dark = settings.load('dark', false)
}
Expand Down
4 changes: 4 additions & 0 deletions src/stores/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,10 @@ const useBaseStore = defineStore('base', {
Object.assign(this.gateway, conf.gateway || {})
Object.assign(this.backup, conf.backup || {})
Object.assign(this.ui, conf.ui || {})

// ensure local storage is in sync with the store
// to prevent theme switch on startup
this.setDarkMode(this.ui.darkMode)
}
},
initPorts(ports) {
Expand Down

0 comments on commit 6ad4d0d

Please sign in to comment.