diff --git a/CHANGELOG.md b/CHANGELOG.md index 60c9d99aaf..20927259a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app/components/use-redirect-to-versioned-cube.tsx b/app/components/use-redirect-to-versioned-cube.tsx index d6a9618f7b..a5902f1f75 100644 --- a/app/components/use-redirect-to-versioned-cube.tsx +++ b/app/components/use-redirect-to-versioned-cube.tsx @@ -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 }), diff --git a/app/pages/_app.tsx b/app/pages/_app.tsx index 0c877b1570..dfc60d377c 100644 --- a/app/pages/_app.tsx +++ b/app/pages/_app.tsx @@ -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);