From d307eb4317ed8ae38758fe550b0ee1063768a550 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 6 Feb 2024 19:38:31 -0800 Subject: [PATCH] Updated team provider. --- src/app/(main)/teams/[teamId]/TeamProvider.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/(main)/teams/[teamId]/TeamProvider.tsx b/src/app/(main)/teams/[teamId]/TeamProvider.tsx index 6f0e391b..1ccdfd64 100644 --- a/src/app/(main)/teams/[teamId]/TeamProvider.tsx +++ b/src/app/(main)/teams/[teamId]/TeamProvider.tsx @@ -5,21 +5,21 @@ import useModified from 'store/modified'; export const TeamContext = createContext(null); -export function TeamProvider({ teamId, children }: { teamId: string; children: ReactNode }) { +export function TeamProvider({ teamId, children }: { teamId?: string; children: ReactNode }) { const modified = useModified(state => state?.[`team:${teamId}`]); const { data: team, isLoading, isFetching, refetch } = useTeam(teamId); useEffect(() => { - if (modified) { + if (teamId && modified) { refetch(); } - }, [modified]); + }, [teamId, modified]); if (isFetching && isLoading) { return ; } - if (!team) { + if (teamId && !team) { return null; }