diff --git a/CHANGELOG.md b/CHANGELOG.md index 60c9d99aa..20927259a 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.spec.tsx b/app/components/use-redirect-to-versioned-cube.spec.tsx index 9c05ddf10..ef3cee332 100644 --- a/app/components/use-redirect-to-versioned-cube.spec.tsx +++ b/app/components/use-redirect-to-versioned-cube.spec.tsx @@ -87,7 +87,7 @@ describe("use redirect to versioned cube", () => { versionedCube: { iri: "https://versioned-cube" }, }); expect(router.replace).toHaveBeenCalledWith({ - pathname: "/de/browse", + pathname: "/browse", query: { dataset: "https://versioned-cube", }, @@ -100,7 +100,7 @@ describe("use redirect to versioned cube", () => { versionedCube: { iri: "https://versioned-cube2" }, }); expect(router.replace).toHaveBeenCalledWith({ - pathname: "/de/browse", + pathname: "/browse", query: { dataset: "https://versioned-cube2", }, diff --git a/app/components/use-redirect-to-versioned-cube.tsx b/app/components/use-redirect-to-versioned-cube.tsx index d6a9618f7..a5902f1f7 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 0c877b157..dfc60d377 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);