Skip to content

Commit affb1bf

Browse files
committed
Render an earlier loading screen fallback
1 parent 0b90c33 commit affb1bf

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

frontend/src/components/Layout/Layout.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// SPDX-License-Identifier: AGPL-3.0-only
55
// Please see LICENSE in the repository root for full details.
66

7-
import { queryOptions, useQuery } from "@tanstack/react-query";
7+
import { queryOptions, useSuspenseQuery } from "@tanstack/react-query";
88
import cx from "classnames";
99
import { Suspense } from "react";
1010
import { graphql } from "../../gql";
@@ -28,7 +28,7 @@ export const query = queryOptions({
2828
});
2929

3030
const AsyncFooter: React.FC = () => {
31-
const result = useQuery(query);
31+
const result = useSuspenseQuery(query);
3232

3333
if (result.error || result.isPending) {
3434
// We probably prefer to render an empty footer in case of an error

frontend/src/router.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// Please see LICENSE in the repository root for full details.
66

77
import { createRouter } from "@tanstack/react-router";
8+
import LoadingScreen from "./components/LoadingScreen";
89
import config from "./config";
910
import { queryClient } from "./graphql";
1011
import { routeTree } from "./routeTree.gen";
@@ -13,6 +14,7 @@ import { routeTree } from "./routeTree.gen";
1314
export const router = createRouter({
1415
routeTree,
1516
basepath: config.root,
17+
defaultPendingComponent: LoadingScreen,
1618
defaultPreload: "intent",
1719
context: { queryClient },
1820
});

0 commit comments

Comments
 (0)