Skip to content

Commit

Permalink
fix(theme): force update title attribute on hydration
Browse files Browse the repository at this point in the history
closes #4004
  • Loading branch information
brc-dd committed Jun 30, 2024
1 parent 143b1e9 commit d348da7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/client/theme-default/components/VPSwitchAppearance.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { inject, computed } from 'vue'
import { inject, ref, watchPostEffect } from 'vue'
import { useData } from '../composables/data'
import VPSwitch from './VPSwitch.vue'
Expand All @@ -9,8 +9,10 @@ const toggleAppearance = inject('toggle-appearance', () => {
isDark.value = !isDark.value
})
const switchTitle = computed(() => {
return isDark.value
const switchTitle = ref('')
watchPostEffect(() => {
switchTitle.value = isDark.value
? theme.value.lightModeSwitchTitle || 'Switch to light theme'
: theme.value.darkModeSwitchTitle || 'Switch to dark theme'
})
Expand Down

0 comments on commit d348da7

Please sign in to comment.