Skip to content

Commit 3c4021c

Browse files
MSD: Collapse redundant resetLocaleData branching
Both `loadOmnibar` and the dashboard `I18nProvider` had an identical four-line if/else that called `resetLocaleData(data)` for the success branch and `resetLocaleData()` for the undefined branch. The two branches are equivalent: `resetLocaleData` accepts an optional `LocaleData` argument and passing `undefined` has the same effect as passing nothing (both clear the data bag and reapply default-domain metadata). Collapse to a single `resetLocaleData( data )` call at each site. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent e6fde86 commit 3c4021c

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

client/dashboard/app/i18n.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,7 @@ export function I18nProvider( { children }: PropsWithChildren ) {
135135
if ( cancelled ) {
136136
return;
137137
}
138-
if ( data ) {
139-
i18n.resetLocaleData( data );
140-
} else {
141-
i18n.resetLocaleData();
142-
}
138+
i18n.resetLocaleData( data );
143139
const realLanguage = data ? language : 'en';
144140
setLoadedLocale( realLanguage );
145141
setLocaleInDOM( i18n, realLanguage );

client/dashboard/app/interim-omnibar/index.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ export default async function loadOmnibar( events: OmnibarEvents ) {
3636
loadUserLocaleData( getUserLanguage( window.currentUser ?? null ) ),
3737
] );
3838

39-
if ( localeData ) {
40-
defaultI18n.resetLocaleData( localeData );
41-
} else {
42-
defaultI18n.resetLocaleData();
43-
}
39+
defaultI18n.resetLocaleData( localeData );
4440

4541
hydrateRoot(
4642
container,

0 commit comments

Comments
 (0)