From c7b4c1ad2f6c06bfaec5f50d5e89611eab2bf3c8 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 7 Jan 2025 13:36:14 +0100 Subject: [PATCH 1/7] Render an earlier loading screen fallback --- frontend/src/components/Layout/Layout.tsx | 4 ++-- frontend/src/router.tsx | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/Layout/Layout.tsx b/frontend/src/components/Layout/Layout.tsx index 989a1f70c..207478cc7 100644 --- a/frontend/src/components/Layout/Layout.tsx +++ b/frontend/src/components/Layout/Layout.tsx @@ -4,7 +4,7 @@ // SPDX-License-Identifier: AGPL-3.0-only // Please see LICENSE in the repository root for full details. -import { queryOptions, useQuery } from "@tanstack/react-query"; +import { queryOptions, useSuspenseQuery } from "@tanstack/react-query"; import cx from "classnames"; import { Suspense } from "react"; import { graphql } from "../../gql"; @@ -28,7 +28,7 @@ export const query = queryOptions({ }); const AsyncFooter: React.FC = () => { - const result = useQuery(query); + const result = useSuspenseQuery(query); if (result.error || result.isPending) { // We probably prefer to render an empty footer in case of an error diff --git a/frontend/src/router.tsx b/frontend/src/router.tsx index efd495292..02d3ed55d 100644 --- a/frontend/src/router.tsx +++ b/frontend/src/router.tsx @@ -5,6 +5,7 @@ // Please see LICENSE in the repository root for full details. import { createRouter } from "@tanstack/react-router"; +import LoadingScreen from "./components/LoadingScreen"; import config from "./config"; import { queryClient } from "./graphql"; import { routeTree } from "./routeTree.gen"; @@ -13,6 +14,7 @@ import { routeTree } from "./routeTree.gen"; export const router = createRouter({ routeTree, basepath: config.root, + defaultPendingComponent: LoadingScreen, defaultPreload: "intent", context: { queryClient }, }); From 28b5b2460e7d70d18c4aa5078ba931e415439af1 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Tue, 7 Jan 2025 13:36:42 +0100 Subject: [PATCH 2/7] Fix the cross signing reset cancel and error screens --- .../routes/reset-cross-signing.cancelled.tsx | 2 +- frontend/src/routes/reset-cross-signing.tsx | 4 +- .../reset-cross-signing.test.tsx.snap | 117 ++++++++++++------ 3 files changed, 82 insertions(+), 41 deletions(-) diff --git a/frontend/src/routes/reset-cross-signing.cancelled.tsx b/frontend/src/routes/reset-cross-signing.cancelled.tsx index 756b8cd97..16be2dc27 100644 --- a/frontend/src/routes/reset-cross-signing.cancelled.tsx +++ b/frontend/src/routes/reset-cross-signing.cancelled.tsx @@ -17,7 +17,7 @@ export const Route = createFileRoute("/reset-cross-signing/cancelled")({ {t("frontend.reset_cross_signing.cancelled.description_1")} diff --git a/frontend/src/routes/reset-cross-signing.tsx b/frontend/src/routes/reset-cross-signing.tsx index d1f55bc7b..2af990b6b 100644 --- a/frontend/src/routes/reset-cross-signing.tsx +++ b/frontend/src/routes/reset-cross-signing.tsx @@ -39,7 +39,7 @@ function ResetCrossSigningError({ }: ErrorComponentProps): React.ReactElement { const { t } = useTranslation(); return ( - <> + reset()}> {t("action.back")} - > + ); } 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 cec1375d4..19666f3b4 100644 --- a/frontend/tests/routes/__snapshots__/reset-cross-signing.test.tsx.snap +++ b/frontend/tests/routes/__snapshots__/reset-cross-signing.test.tsx.snap @@ -12,7 +12,7 @@ exports[`Reset cross signing > renders the cancelled page 1`] = ` class="_pageHeading_c10486" > renders the deep link page 1`] = ` exports[`Reset cross signing > renders the errored page 1`] = ` - - - - - - - + + + + + + Failed to allow crypto identity reset + + + + + This might be a temporary problem, so please try again later. If the problem persists, please contact your server administrator. + + + Back + + - - - This might be a temporary problem, so please try again later. If the problem persists, please contact your server administrator. - - - Back - + All Rights Reserved. The Super Chat name, logo and device are registered trade marks of BigCorp Ltd. +
+ This might be a temporary problem, so please try again later. If the problem persists, please contact your server administrator. +
- This might be a temporary problem, so please try again later. If the problem persists, please contact your server administrator. -
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Sed id felis eget orci aliquet tincidunt.
+ {description} +