-
Notifications
You must be signed in to change notification settings - Fork 1
fix: preserve interactive member locale selection #328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
63dfc21
d0e1598
5d1a82d
47b1a94
6632c1c
fb77eb7
143e50a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,6 +96,7 @@ import { | |
| isSupportedLocale, | ||
| LOCALE_LABELS, | ||
| SUPPORTED_LOCALES, | ||
| getLocale, | ||
| setLocale, | ||
| t, | ||
| tf, | ||
|
|
@@ -4581,9 +4582,16 @@ export default function App({ showLabPanels = false }: { showLabPanels?: boolean | |
| useEffect(() => { | ||
| if (!accessToken) return; | ||
| let active = true; | ||
| const localeBeforeMemberFetch = getLocale(); | ||
| fetchMe(accessToken) | ||
| .then((member) => { | ||
| if (active && isSupportedLocale(member.preferred_locale)) setLocale(member.preferred_locale); | ||
| if ( | ||
| active && | ||
| getLocale() === localeBeforeMemberFetch && | ||
| isSupportedLocale(member.preferred_locale) | ||
| ) { | ||
| setLocale(member.preferred_locale); | ||
| } | ||
|
Comment on lines
+4588
to
+4594
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Selecting the already-current locale is not treated as an interaction The guard Was this helpful? React with 👍 or 👎 to provide feedback. |
||
| }) | ||
| .catch(() => undefined); | ||
| return () => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Info: Server preference still wins on clean login
With no interaction,
getLocale()still equals the captured value whenfetchMeresolves, so the server preference applies as before. The captured value can be a localStorage-restored locale, and the server value still overrides it, preserving the ADR 0069 login rule.Was this helpful? React with 👍 or 👎 to provide feedback.