From 763de454e702d971fdc11435bbd1d15f6f551001 Mon Sep 17 00:00:00 2001 From: Liam Date: Thu, 12 Sep 2024 11:38:19 +0100 Subject: [PATCH] add stale time to score data --- src/components/input/pagination.tsx | 13 ++++++++++++- src/components/player/player-scores.tsx | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/input/pagination.tsx b/src/components/input/pagination.tsx index beb5bc9..49ac792 100644 --- a/src/components/input/pagination.tsx +++ b/src/components/input/pagination.tsx @@ -12,13 +12,24 @@ import { } from "../ui/pagination"; type PaginationItemWrapperProps = { + /** + * Whether a page is currently loading. + */ isLoadingPage: boolean; + + /** + * The children to render. + */ children: React.ReactNode; }; function PaginationItemWrapper({ isLoadingPage, children }: PaginationItemWrapperProps) { return ( - + {children} ); diff --git a/src/components/player/player-scores.tsx b/src/components/player/player-scores.tsx index 5b26944..3eaa379 100644 --- a/src/components/player/player-scores.tsx +++ b/src/components/player/player-scores.tsx @@ -28,6 +28,7 @@ export default function PlayerScores({ player, sort, page }: Props) { const { data, isError, isLoading, refetch } = useQuery({ queryKey: ["playerScores", player.id, currentSort, currentPage], queryFn: () => scoresaberFetcher.lookupPlayerScores(player.id, currentSort, currentPage), + staleTime: 30 * 1000, // Data will be cached for 30 seconds }); useEffect(() => {