Skip to content

Commit

Permalink
move initDefaultLanguage into effect
Browse files Browse the repository at this point in the history
  • Loading branch information
denysoblohin-okta committed Sep 5, 2024
1 parent 979f526 commit 1c35e37
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/v3/src/components/Widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,17 @@ export const Widget: FunctionComponent<WidgetProps> = (widgetProps) => {
};
}, [brandColors, customTheme, languageDirection]);

// load default language (once)
initDefaultLanguage();

// on unmount, remove the language
useEffect(() => () => {
if (Bundles.isLoaded(languageCode)) {
Bundles.remove();
unloadLanguage(languageCode);
}
useEffect(() => {
// load default language once
initDefaultLanguage();

// on unmount, remove the language
return () => {
if (Bundles.isLoaded(languageCode)) {
Bundles.remove();
unloadLanguage(languageCode);
}
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);

Expand Down

0 comments on commit 1c35e37

Please sign in to comment.