From 47a4db520da73d630b94681b505fb12eccde358c Mon Sep 17 00:00:00 2001
From: Quentin Gliech
Date: Fri, 31 Jan 2025 18:24:30 +0100
Subject: [PATCH] Switch to the new scroll restoration API & update snapshots
---
frontend/src/router.tsx | 1 +
frontend/src/routes/__root.tsx | 2 --
.../reset-cross-signing.test.tsx.snap | 18 ++++++++++++++++++
.../account/__snapshots__/index.test.tsx.snap | 3 +++
4 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx
index 02d3ed55d..db2076e0a 100644
--- a/frontend/src/router.tsx
+++ b/frontend/src/router.tsx
@@ -13,6 +13,7 @@ import { routeTree } from "./routeTree.gen";
// Create a new router instance
export const router = createRouter({
routeTree,
+ scrollRestoration: true,
basepath: config.root,
defaultPendingComponent: LoadingScreen,
defaultPreload: "intent",
diff --git a/frontend/src/routes/__root.tsx b/frontend/src/routes/__root.tsx
index 21ca5d8e2..a4ab23b30 100644
--- a/frontend/src/routes/__root.tsx
+++ b/frontend/src/routes/__root.tsx
@@ -9,7 +9,6 @@ import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
import {
type ErrorRouteComponent,
Outlet,
- ScrollRestoration,
createRootRouteWithContext,
} from "@tanstack/react-router";
import { TanStackRouterDevtools } from "@tanstack/router-devtools";
@@ -28,7 +27,6 @@ export const Route = createRootRouteWithContext<{
}>()({
component: () => (
<>
-
{import.meta.env.DEV &&
diff --git a/frontend/tests/routes/__snapshots__/reset-cross-signing.test.tsx.snap b/frontend/tests/routes/__snapshots__/reset-cross-signing.test.tsx.snap
index 19666f3b4..5964df356 100644
--- a/frontend/tests/routes/__snapshots__/reset-cross-signing.test.tsx.snap
+++ b/frontend/tests/routes/__snapshots__/reset-cross-signing.test.tsx.snap
@@ -48,6 +48,9 @@ exports[`Reset cross signing > renders the cancelled page 1`] = `
+
`;
@@ -234,6 +237,9 @@ exports[`Reset cross signing > renders the deep link page 1`] = `
+
`;
@@ -322,6 +328,9 @@ exports[`Reset cross signing > renders the errored page 1`] = `
+
`;
@@ -508,6 +517,9 @@ exports[`Reset cross signing > renders the page 1`] = `
+
`;
@@ -554,6 +566,9 @@ exports[`Reset cross signing > renders the success page 1`] = `
+
`;
@@ -600,5 +615,8 @@ exports[`Reset cross signing > renders the success page 2`] = `
+
`;
diff --git a/frontend/tests/routes/account/__snapshots__/index.test.tsx.snap b/frontend/tests/routes/account/__snapshots__/index.test.tsx.snap
index 48fa1e3be..3b0948a4e 100644
--- a/frontend/tests/routes/account/__snapshots__/index.test.tsx.snap
+++ b/frontend/tests/routes/account/__snapshots__/index.test.tsx.snap
@@ -736,5 +736,8 @@ exports[`Account home page > renders the page 1`] = `
+
`;