From 57676abb0224f15c68446c67340f275422494c6c Mon Sep 17 00:00:00 2001 From: Emmy D'Anello Date: Sat, 14 Dec 2024 00:53:22 +0100 Subject: [PATCH] =?UTF-8?q?Stabilit=C3=A9=20t=C3=A9l=C3=A9chargement=20des?= =?UTF-8?q?=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/components/GameProvider.tsx | 2 ++ client/components/GeolocationProvider.tsx | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/components/GameProvider.tsx b/client/components/GameProvider.tsx index dcb5938..56e3b12 100644 --- a/client/components/GameProvider.tsx +++ b/client/components/GameProvider.tsx @@ -57,6 +57,7 @@ export default function GameProvider({ children }: { children: ReactNode }) { headers: { "Authorization": `Bearer ${auth.token}` }} ).then(resp => resp.json()), enabled: isAuthValid(auth) && !!game.playerId, + initialData: { data: [], meta: { currentPage: 0, lastPage: 0, nextPage: 0, prevPage: 0, total: 0, totalPerPage: 0 } }, refetchInterval: 5000, }) useEffect(() => { @@ -70,6 +71,7 @@ export default function GameProvider({ children }: { children: ReactNode }) { headers: { "Authorization": `Bearer ${auth.token}` }} ).then(resp => resp.json()), enabled: isAuthValid(auth), + initialData: { data: [], meta: { currentPage: 0, lastPage: 0, nextPage: 0, prevPage: 0, total: 0, totalPerPage: 0 } }, refetchInterval: 5000, }) useEffect(() => { diff --git a/client/components/GeolocationProvider.tsx b/client/components/GeolocationProvider.tsx index 6e42c5c..f855beb 100644 --- a/client/components/GeolocationProvider.tsx +++ b/client/components/GeolocationProvider.tsx @@ -39,13 +39,14 @@ export default function GeolocationProvider({ children }: { children: ReactNode "Content-Type": "application/json", }, }).then(resp => resp.json()), + initialData: [], enabled: isAuthValid(auth), refetchInterval: 5000, }) useEffect(() => { if (lastLocationsQuery.isSuccess && lastLocationsQuery.data) setLastPlayerLocations(lastLocationsQuery.data) - }, [lastLocationsQuery.status, lastLocationsQuery.dataUpdatedAt, auth]) + }, [lastLocationsQuery.status, lastLocationsQuery.dataUpdatedAt]) return <> {children}