fix imports and add a player data refresh interval
All checks were successful
Deploy Website / deploy (push) Successful in 3m53s
All checks were successful
Deploy Website / deploy (push) Successful in 3m53s
This commit is contained in:
parent
094e030f11
commit
6b8244fa48
@ -7,7 +7,6 @@ import useDatabase from "../../hooks/use-database";
|
|||||||
import { useToast } from "@/hooks/use-toast";
|
import { useToast } from "@/hooks/use-toast";
|
||||||
import Tooltip from "../tooltip";
|
import Tooltip from "../tooltip";
|
||||||
import { Button } from "../ui/button";
|
import { Button } from "../ui/button";
|
||||||
import { router } from "next/client";
|
|
||||||
import { revalidatePath } from "next/cache";
|
import { revalidatePath } from "next/cache";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
|
@ -16,10 +16,11 @@ import { ScoreSort } from "@ssr/common/types/score/score-sort";
|
|||||||
import { scoresaberService } from "@ssr/common/service/impl/scoresaber";
|
import { scoresaberService } from "@ssr/common/service/impl/scoresaber";
|
||||||
import { config } from "../../../config";
|
import { config } from "../../../config";
|
||||||
import { getPlayerIdCookie } from "@/common/website-utils";
|
import { getPlayerIdCookie } from "@/common/website-utils";
|
||||||
import { useGetPlayerIdCookie } from "@/hooks/use-player-id-cookie";
|
|
||||||
import useDatabase from "@/hooks/use-database";
|
import useDatabase from "@/hooks/use-database";
|
||||||
import { useLiveQuery } from "dexie-react-hooks";
|
import { useLiveQuery } from "dexie-react-hooks";
|
||||||
|
|
||||||
|
const REFRESH_INTERVAL = 1000 * 60 * 5;
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
initialPlayerData: ScoreSaberPlayer;
|
initialPlayerData: ScoreSaberPlayer;
|
||||||
initialScoreData?: ScoreSaberPlayerScoresPageToken;
|
initialScoreData?: ScoreSaberPlayerScoresPageToken;
|
||||||
@ -51,7 +52,9 @@ export default function PlayerData({
|
|||||||
}
|
}
|
||||||
return await getScoreSaberPlayerFromToken(playerResponse, config.siteApi, getPlayerIdCookie());
|
return await getScoreSaberPlayerFromToken(playerResponse, config.siteApi, getPlayerIdCookie());
|
||||||
},
|
},
|
||||||
staleTime: 1000 * 60 * 5, // Cache data for 5 minutes
|
staleTime: REFRESH_INTERVAL,
|
||||||
|
refetchInterval: REFRESH_INTERVAL,
|
||||||
|
refetchIntervalInBackground: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (data && (!isLoading || !isError)) {
|
if (data && (!isLoading || !isError)) {
|
||||||
|
Reference in New Issue
Block a user