Skip to content

Commit 587f2cb

Browse files
fix(stats): show the current language in the footer select (#59772)
Co-authored-by: neriousy <34747899+neriousy@users.noreply.github.com>
1 parent fa1260d commit 587f2cb

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎packages/stats/app/src/routes/stats-shell.tsx‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,6 @@ function FooterLanguageSwitcher() {
309309
<label data-slot="footer-language">
310310
<span>{i18n.t("footer.language")}</span>
311311
<select
312-
value={language.locale()}
313312
aria-label={i18n.t("footer.language")}
314313
onChange={(event) => {
315314
const locale = event.currentTarget.value as Locale
@@ -320,7 +319,14 @@ function FooterLanguageSwitcher() {
320319
if (href !== current) window.location.assign(href)
321320
}}
322321
>
323-
<For each={language.locales}>{(locale) => <option value={locale}>{language.label(locale)}</option>}</For>
322+
{/* Mark the option, not the select: SSR ignores a select value and hydration does not apply it. */}
323+
<For each={language.locales}>
324+
{(locale) => (
325+
<option value={locale} selected={locale === language.locale()}>
326+
{language.label(locale)}
327+
</option>
328+
)}
329+
</For>
324330
</select>
325331
</label>
326332
)

0 commit comments

Comments
 (0)