Skip to content

Commit c03d6ca

Browse files
fix: avoid mismatch of selected language on hydration (#305)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent c39683a commit c03d6ca

2 files changed

Lines changed: 17 additions & 12 deletions

File tree

app/pages/settings.vue

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ defineOgImageComponent('Default', {
203203
</div>
204204
</section>
205205

206-
<!-- LANGUAGE Section -->
207206
<section>
208207
<h2 class="text-xs text-fg-subtle uppercase tracking-wider mb-4">
209208
{{ $t('settings.sections.language') }}
@@ -214,16 +213,22 @@ defineOgImageComponent('Default', {
214213
<label for="language-select" class="block text-sm text-fg font-medium">
215214
{{ $t('settings.language') }}
216215
</label>
217-
<select
218-
id="language-select"
219-
:value="locale"
220-
class="w-full sm:w-auto min-w-48 bg-bg border border-border rounded-md px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 cursor-pointer"
221-
@change="setLocale(($event.target as HTMLSelectElement).value as typeof locale)"
222-
>
223-
<option v-for="loc in availableLocales" :key="loc.code" :value="loc.code">
224-
{{ loc.name }}
225-
</option>
226-
</select>
216+
217+
<ClientOnly>
218+
<select
219+
id="language-select"
220+
:value="locale"
221+
class="w-full sm:w-auto min-w-48 bg-bg border border-border rounded-md px-3 py-2 text-sm text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 cursor-pointer"
222+
@change="setLocale(($event.target as HTMLSelectElement).value as typeof locale)"
223+
>
224+
<option v-for="loc in availableLocales" :key="loc.code" :value="loc.code">
225+
{{ loc.name }}
226+
</option>
227+
</select>
228+
<template #fallback>
229+
<span class="skeleton block w-48 h-8" />
230+
</template>
231+
</ClientOnly>
227232
</div>
228233

229234
<!-- Translation helper for non-source locales -->

lunaria/files/en-US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@
573573
},
574574
"contributors": {
575575
"title": "Contributors",
576-
"description": "npmx is fully open source, built by an amazing community of contributors.",
576+
"description": "npmx is fully open source, built by an amazing community of contributors. Join us and let's build the npm browsing experience we always wanted, together.",
577577
"loading": "Loading contributors...",
578578
"error": "Failed to load contributors",
579579
"view_profile": "View {name}'s GitHub profile"

0 commit comments

Comments
 (0)