make all queries re fetch every 5 mins
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m12s

This commit is contained in:
Lee 2024-10-21 07:43:18 +01:00
parent 6baeab930d
commit ad826d7a3f
3 changed files with 2 additions and 8 deletions

@ -19,8 +19,6 @@ import ScoreSaberScore from "@ssr/common/score/impl/scoresaber-score";
import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard"; import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leaderboard";
import PlayerScoresResponse from "@ssr/common/response/player-scores-response"; import PlayerScoresResponse from "@ssr/common/response/player-scores-response";
const REFRESH_INTERVAL = 1000 * 60 * 5;
type Props = { type Props = {
initialPlayerData: ScoreSaberPlayer; initialPlayerData: ScoreSaberPlayer;
initialScoreData?: PlayerScoresResponse<ScoreSaberScore, ScoreSaberLeaderboard>; initialScoreData?: PlayerScoresResponse<ScoreSaberScore, ScoreSaberLeaderboard>;
@ -47,8 +45,6 @@ export default function PlayerData({ initialPlayerData, initialScoreData, initia
} }
return await getScoreSaberPlayerFromToken(playerResponse, settings?.playerId); return await getScoreSaberPlayerFromToken(playerResponse, settings?.playerId);
}, },
refetchInterval: REFRESH_INTERVAL,
refetchIntervalInBackground: false,
}); });
if (data && (!isLoading || !isError)) { if (data && (!isLoading || !isError)) {

@ -20,8 +20,6 @@ import ScoreSaberLeaderboard from "@ssr/common/leaderboard/impl/scoresaber-leade
import { fetchPlayerScores } from "@ssr/common/utils/score-utils"; import { fetchPlayerScores } from "@ssr/common/utils/score-utils";
import PlayerScoresResponse from "@ssr/common/response/player-scores-response"; import PlayerScoresResponse from "@ssr/common/response/player-scores-response";
const REFRESH_INTERVAL = 1000 * 60 * 5;
type Props = { type Props = {
initialScoreData?: PlayerScoresResponse<ScoreSaberScore, ScoreSaberLeaderboard>; initialScoreData?: PlayerScoresResponse<ScoreSaberScore, ScoreSaberLeaderboard>;
initialSearch?: string; initialSearch?: string;
@ -73,8 +71,6 @@ export default function PlayerScores({ initialScoreData, initialSearch, player,
pageState.sort, pageState.sort,
debouncedSearchTerm debouncedSearchTerm
), ),
refetchInterval: REFRESH_INTERVAL,
refetchIntervalInBackground: false,
enabled: shouldFetch && (debouncedSearchTerm.length >= 3 || debouncedSearchTerm.length === 0), enabled: shouldFetch && (debouncedSearchTerm.length >= 3 || debouncedSearchTerm.length === 0),
}); });

@ -11,6 +11,8 @@ const queryClient = new QueryClient({
defaultOptions: { defaultOptions: {
queries: { queries: {
staleTime: 1000 * 30, // 30 seconds staleTime: 1000 * 30, // 30 seconds
refetchInterval: 1000 * 60 * 5, // 5 minutes
refetchIntervalInBackground: false,
}, },
}, },
}); });