Skip to content

Commit

Permalink
♻️ Use watch instead of subscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
rubjo committed Aug 21, 2024
1 parent 690b5d9 commit 5bdf7c5
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions site/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
// MM
// .JMML.
import { watch } from 'vue'
import PToast from 'primevue/toast'
import PButton from 'primevue/button'
Expand Down Expand Up @@ -91,15 +93,12 @@
setTheme()
}
store.$subscribe((mutation, state) => {
console.log(mutation)
console.log(state)
const appearanceChanged = ['paletteModel', 'hue', 'sat', 'lux'].includes(
mutation.events?.key,
)
if (appearanceChanged) setTheme()
})
watch(
() => [store.paletteModel, store.hue, store.sat, store.lux],
() => {
setTheme()
},
)
const init = async () => {
await Promise.all([loadSettings()])
Expand Down

0 comments on commit 5bdf7c5

Please sign in to comment.