Skip to content

Commit

Permalink
Fix language switcher (#4341)
Browse files Browse the repository at this point in the history
* Fix language switcher

* Changeset

* Fix typo
  • Loading branch information
andrzejewsky authored Oct 18, 2023
1 parent b488e85 commit b792f98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tricky-needles-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Fix language switcher
14 changes: 13 additions & 1 deletion src/staff/components/StaffPreferences/StaffPreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ const StaffPreferences: React.FC<StaffPreferencesProps> = ({
}) => {
const intl = useIntl();

const handleLocaleChange = async (locale: Locale) => {
await onLocaleChange(locale);

/*
Workaround, after changing language we reload the page.
saleor-sdk causes the error related to wrong cache management.
Migration to auth-sdk can solve it.
Ref: https://github.com/saleor/saleor-dashboard/issues/4340
*/
window.location.reload();
};

return (
<Card>
<CardTitle
Expand Down Expand Up @@ -45,7 +57,7 @@ const StaffPreferences: React.FC<StaffPreferencesProps> = ({
})}
name="locale"
value={locale}
onChange={event => onLocaleChange(event.target.value)}
onChange={event => handleLocaleChange(event.target.value)}
/>
<FormSpacer />
<Typography>
Expand Down

0 comments on commit b792f98

Please sign in to comment.