Skip to content

Commit d348da7

Browse files
committed
fix(theme): force update title attribute on hydration
closes #4004
1 parent 143b1e9 commit d348da7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Diff for: src/client/theme-default/components/VPSwitchAppearance.vue

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { inject, computed } from 'vue'
2+
import { inject, ref, watchPostEffect } from 'vue'
33
import { useData } from '../composables/data'
44
import VPSwitch from './VPSwitch.vue'
55
@@ -9,8 +9,10 @@ const toggleAppearance = inject('toggle-appearance', () => {
99
isDark.value = !isDark.value
1010
})
1111
12-
const switchTitle = computed(() => {
13-
return isDark.value
12+
const switchTitle = ref('')
13+
14+
watchPostEffect(() => {
15+
switchTitle.value = isDark.value
1416
? theme.value.lightModeSwitchTitle || 'Switch to light theme'
1517
: theme.value.darkModeSwitchTitle || 'Switch to dark theme'
1618
})

0 commit comments

Comments
 (0)