refresh interval on scores
All checks were successful
Deploy Website / docker (ubuntu-latest) (push) Successful in 2m11s

This commit is contained in:
Lee 2024-10-19 11:31:53 +01:00
parent ac6aaee208
commit cec3541345

View File

@ -20,6 +20,8 @@ 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<ScoreSaberScore, ScoreSaberLeaderboard>;
initialSearch?: string;
@ -71,7 +73,8 @@ export default function PlayerScores({ initialScoreData, initialSearch, player,
pageState.sort,
debouncedSearchTerm
),
staleTime: 30 * 1000, // 30 seconds
refetchInterval: REFRESH_INTERVAL,
refetchIntervalInBackground: false,
enabled: shouldFetch && (debouncedSearchTerm.length >= 3 || debouncedSearchTerm.length === 0),
});