Skip to content

Commit

Permalink
fix: Fix setting null/undefined value in AsyncStorage (#912)
Browse files Browse the repository at this point in the history
  • Loading branch information
amaury1093 authored Mar 2, 2021
1 parent 0aa0edc commit b39fc67
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions App/stores/location.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,12 @@ export function LocationContextProvider({
}, []); // eslint-disable-line react-hooks/exhaustive-deps

useEffect(() => {
AsyncStorage.setItem(
LAST_KNOWN_LOCATION_KEY,
JSON.stringify(currentLocation)
(currentLocation
? AsyncStorage.setItem(
LAST_KNOWN_LOCATION_KEY,
JSON.stringify(currentLocation)
)
: AsyncStorage.removeItem(LAST_KNOWN_LOCATION_KEY)
).catch(sentryError('LocationContextProvider'));
}, [currentLocation]);

Expand Down

0 comments on commit b39fc67

Please sign in to comment.