From ad826d7a3f6b4ab85d92ae8c719faa84a2ee6895 Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 21 Oct 2024 07:43:18 +0100 Subject: [PATCH] make all queries re fetch every 5 mins --- projects/website/src/components/player/player-data.tsx | 4 ---- projects/website/src/components/player/player-scores.tsx | 4 ---- projects/website/src/components/providers/query-provider.tsx | 2 ++ 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/projects/website/src/components/player/player-data.tsx b/projects/website/src/components/player/player-data.tsx index f75e7dd..b83bc8f 100644 --- a/projects/website/src/components/player/player-data.tsx +++ b/projects/website/src/components/player/player-data.tsx @@ -19,8 +19,6 @@ import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score"; import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard"; import PlayerScoresResponse from "@ssr/common/response/player-scores-response"; -const REFRESH_INTERVAL = 1000 * 60 * 5; - type Props = { initialPlayerData: ScoreSaberPlayer; initialScoreData?: PlayerScoresResponse; @@ -47,8 +45,6 @@ export default function PlayerData({ initialPlayerData, initialScoreData, initia } return await getScoreSaberPlayerFromToken(playerResponse, settings?.playerId); }, - refetchInterval: REFRESH_INTERVAL, - refetchIntervalInBackground: false, }); if (data && (!isLoading || !isError)) { diff --git a/projects/website/src/components/player/player-scores.tsx b/projects/website/src/components/player/player-scores.tsx index 8352936..d73d2e5 100644 --- a/projects/website/src/components/player/player-scores.tsx +++ b/projects/website/src/components/player/player-scores.tsx @@ -20,8 +20,6 @@ import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leade import { fetchPlayerScores } from "@ssr/common/utils/score-utils"; import PlayerScoresResponse from "@ssr/common/response/player-scores-response"; -const REFRESH_INTERVAL = 1000 * 60 * 5; - type Props = { initialScoreData?: PlayerScoresResponse; initialSearch?: string; @@ -73,8 +71,6 @@ export default function PlayerScores({ initialScoreData, initialSearch, player, pageState.sort, debouncedSearchTerm ), - refetchInterval: REFRESH_INTERVAL, - refetchIntervalInBackground: false, enabled: shouldFetch && (debouncedSearchTerm.length >= 3 || debouncedSearchTerm.length === 0), }); diff --git a/projects/website/src/components/providers/query-provider.tsx b/projects/website/src/components/providers/query-provider.tsx index 5939a64..9e702cb 100644 --- a/projects/website/src/components/providers/query-provider.tsx +++ b/projects/website/src/components/providers/query-provider.tsx @@ -11,6 +11,8 @@ const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: 1000 * 30, // 30 seconds + refetchInterval: 1000 * 60 * 5, // 5 minutes + refetchIntervalInBackground: false, }, }, });