Skip to content

Commit

Permalink
fix: Overwriting of locale when redirecting to versioned cube
Browse files Browse the repository at this point in the history
...there is no need to specify the locale in pathname. Using this led to overwiting the locale, as we used the old locale, while the router was setting a new one on route change.
  • Loading branch information
bprusinowski committed Sep 12, 2023
1 parent 49153ea commit aad7d94
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ You can also check the [release page](https://github.com/visualize-admin/visuali

- Fixes
- Table docs now work correctly again
- Changing the locale when previewing a larger cube no longer triggers multiple locale switches

# [3.22.5] - 2023-09-12

Expand Down
2 changes: 1 addition & 1 deletion app/components/use-redirect-to-versioned-cube.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const useRedirectToVersionedCube = ({

if (resp) {
router.replace({
pathname: `/${locale}/browse`,
pathname: `/browse`,
query: {
...router.query,
...(router.query.iri ? { iri: resp.iri } : { dataset: resp.iri }),
Expand Down
3 changes: 1 addition & 2 deletions app/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ export default function App({
pageProps: { session, ...pageProps },
}: AppProps) {
const { events: routerEvents, asPath, locale: routerLocale } = useRouter();
const locale = parseLocaleString(routerLocale ?? "");

useNProgress();

const locale = parseLocaleString(routerLocale ?? "");

// Immediately activate locale to avoid re-render
if (i18n.locale !== locale) {
i18n.activate(locale);
Expand Down

0 comments on commit aad7d94

Please sign in to comment.