Skip to content

Commit

Permalink
fix: Fix bugs with "Not saving" on startup and no reverse location na…
Browse files Browse the repository at this point in the history
…me (#164)

* Fix bug station too far on initial load

* Don't show erronous location names
  • Loading branch information
amaury1093 authored Aug 10, 2019
1 parent 1303bae commit 5ae06ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions App/stores/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export function ApiContextProvider ({ children }: ApiContextProviderProps) {
isGps
? pipe(
saveApi(currentLocation, newApi),
TE.orElse(() => TE.right(undefined as void)), // Silently ignore if saveApi fails
TE.map(() => newApi)
)
: TE.right(newApi)
Expand Down
7 changes: 6 additions & 1 deletion App/stores/fetchGpsPosition/fetchGpsPosition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ export function fetchReverseGeocode (currentLocation: LatLng) {
...currentLocation,
city: reverse.city,
country: reverse.country,
name: [reverse.street, reverse.city, reverse.country].join(', ')
name:
[reverse.street, reverse.city, reverse.country]
.filter(x => x)
.join(', ') ||
// This case happens when e.g. we're in the middle of the ocean
[reverse.name, reverse.country].filter(x => x).join(', ')
} as Location)
)
);
Expand Down

0 comments on commit 5ae06ef

Please sign in to comment.