Skip to content

Commit

Permalink
fix(spaces nearby): get correctly geolocation from user
Browse files Browse the repository at this point in the history
handle null cases
  • Loading branch information
pyphilia committed Sep 4, 2020
1 parent a3a7851 commit 0a63a6a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/SpacesNearby.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class SpacesNearby extends Component {
searchQuery: prevSearchQuery,
}) {
const { geolocation, spaces, searchQuery } = this.props;
if (!geolocation.equals(prevGeolocation)) {
if (!geolocation?.equals(prevGeolocation)) {
this.getSpacesNearby();
}
if (!spaces.equals(prevSpaces) || searchQuery !== prevSearchQuery) {
Expand All @@ -78,7 +78,7 @@ class SpacesNearby extends Component {

getSpacesNearby = () => {
const { dispatchGetSpacesNearby, geolocation } = this.props;
if (!geolocation.isEmpty()) {
if (geolocation && !geolocation.isEmpty()) {
const {
coords: { latitude, longitude },
} = geolocation.toJS();
Expand Down Expand Up @@ -130,7 +130,7 @@ class SpacesNearby extends Component {
}

const mapStateToProps = ({ authentication, Space }) => ({
geolocation: authentication.getIn(['user', 'settings', 'geolocation']),
geolocation: authentication.getIn(['user', 'geolocation']),
spaces: Space.getIn(['nearby', 'content']),
activity: Boolean(Space.getIn(['nearby', 'activity']).size),
geolocationEnabled: authentication.getIn([
Expand Down

0 comments on commit 0a63a6a

Please sign in to comment.