#640 - multiple location fetches were occurring simultaneously (#699)

Closes #640
This commit is contained in:
budowski
2023-07-10 17:33:29 -06:00
committed by GitHub
parent 2a24fc4a06
commit 0fe51ebdc6

View File

@@ -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;