From 87841d69238c93661210564984f43383eaf2d280 Mon Sep 17 00:00:00 2001 From: Bruce Glazier Date: Thu, 16 May 2024 08:52:54 -0400 Subject: [PATCH] fix: Only retry query when option is enabled --- src/hooks/useActiveProject.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/hooks/useActiveProject.tsx b/src/hooks/useActiveProject.tsx index 5146a89a..a969b8d5 100644 --- a/src/hooks/useActiveProject.tsx +++ b/src/hooks/useActiveProject.tsx @@ -10,6 +10,7 @@ import { InviteRequiredScreen } from '../screens/InviteRequiredScreen'; import { useRestQuery } from './rest-api'; import { useActiveAccount } from './useActiveAccount'; import { useDeveloperConfig } from './useDeveloperConfig'; +import { tID } from '../common/testID'; const selectedProjectIdKey = 'selectedProjectIdKey'; @@ -154,10 +155,14 @@ export const ActiveProjectContextProvider: React.FC { - if (!query.isRefetching && state.status === 'not-a-patient') { + if ( + !query.isRefetching && + state.status === 'not-a-patient' && + keepWaitingForPatientId + ) { query.refetchAll(); } - }, [query, state.status]); + }, [keepWaitingForPatientId, query, state.status]); // This effect handles setting the initial value in async storage. const activeProjectId = @@ -180,6 +185,7 @@ export const ActiveProjectContextProvider: React.FC