Skip to content

Commit 2caba19

Browse files
authored
fix: prevent settings accent color being unset on hydration (#395)
1 parent 5c2261f commit 2caba19

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

app/components/AccentColorPicker.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
import { useAccentColor } from '~/composables/useSettings'
33
44
const { accentColors, selectedAccentColor, setAccentColor } = useAccentColor()
5+
6+
onPrehydrate(el => {
7+
const settings = JSON.parse(localStorage.getItem('npmx-settings') || '{}')
8+
const id = settings.accentColorId
9+
if (id) {
10+
const input = el.querySelector<HTMLInputElement>(`input[value="${id}"]`)
11+
if (input) {
12+
input.checked = true
13+
}
14+
}
15+
})
516
</script>
617

718
<template>

0 commit comments

Comments
 (0)