From 0fe51ebdc6c7105758961d6dcd55cda95efcc142 Mon Sep 17 00:00:00 2001 From: budowski Date: Mon, 10 Jul 2023 17:33:29 -0600 Subject: [PATCH] #640 - multiple location fetches were occurring simultaneously (#699) Closes #640 --- src/sharedHooks/useCurrentObservationLocation.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sharedHooks/useCurrentObservationLocation.js b/src/sharedHooks/useCurrentObservationLocation.js index 8c254da19..d8d4b296c 100644 --- a/src/sharedHooks/useCurrentObservationLocation.js +++ b/src/sharedHooks/useCurrentObservationLocation.js @@ -49,8 +49,6 @@ const useCurrentObservationLocation = ( mountedRef: any ): Object => { if ( !mountedRef.current ) return; if ( !shouldFetchLocation ) return; - setFetchingLocation( false ); - const location = await fetchUserLocation( ); // If we're still receiving location updates and location is blank, @@ -63,6 +61,8 @@ const useCurrentObservationLocation = ( mountedRef: any ): Object => { positional_accuracy: location?.positional_accuracy } ); + setFetchingLocation( false ); + // The local state version of positionalAccuracy needs to be a number, // so don't set it to const newPositionalAccuracy = location?.positional_accuracy || INITIAL_POSITIONAL_ACCURACY;