add stale time to score data
All checks were successful
Deploy SSR / deploy (push) Successful in 1m8s
All checks were successful
Deploy SSR / deploy (push) Successful in 1m8s
This commit is contained in:
parent
f0dfbe78ea
commit
763de454e7
@ -12,13 +12,24 @@ import {
|
|||||||
} from "../ui/pagination";
|
} from "../ui/pagination";
|
||||||
|
|
||||||
type PaginationItemWrapperProps = {
|
type PaginationItemWrapperProps = {
|
||||||
|
/**
|
||||||
|
* Whether a page is currently loading.
|
||||||
|
*/
|
||||||
isLoadingPage: boolean;
|
isLoadingPage: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The children to render.
|
||||||
|
*/
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
function PaginationItemWrapper({ isLoadingPage, children }: PaginationItemWrapperProps) {
|
function PaginationItemWrapper({ isLoadingPage, children }: PaginationItemWrapperProps) {
|
||||||
return (
|
return (
|
||||||
<PaginationItem className={clsx(isLoadingPage ? "cursor-not-allowed" : "cursor-pointer")}>
|
<PaginationItem
|
||||||
|
className={clsx(isLoadingPage ? "cursor-not-allowed" : "cursor-pointer")}
|
||||||
|
aria-disabled={isLoadingPage}
|
||||||
|
tabIndex={isLoadingPage ? -1 : undefined}
|
||||||
|
>
|
||||||
{children}
|
{children}
|
||||||
</PaginationItem>
|
</PaginationItem>
|
||||||
);
|
);
|
||||||
|
@ -28,6 +28,7 @@ export default function PlayerScores({ player, sort, page }: Props) {
|
|||||||
const { data, isError, isLoading, refetch } = useQuery({
|
const { data, isError, isLoading, refetch } = useQuery({
|
||||||
queryKey: ["playerScores", player.id, currentSort, currentPage],
|
queryKey: ["playerScores", player.id, currentSort, currentPage],
|
||||||
queryFn: () => scoresaberFetcher.lookupPlayerScores(player.id, currentSort, currentPage),
|
queryFn: () => scoresaberFetcher.lookupPlayerScores(player.id, currentSort, currentPage),
|
||||||
|
staleTime: 30 * 1000, // Data will be cached for 30 seconds
|
||||||
});
|
});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Reference in New Issue
Block a user