Skip to content

Commit 0a63a6a

Browse files
committed
fix(spaces nearby): get correctly geolocation from user
handle null cases
1 parent a3a7851 commit 0a63a6a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/components/SpacesNearby.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class SpacesNearby extends Component {
6868
searchQuery: prevSearchQuery,
6969
}) {
7070
const { geolocation, spaces, searchQuery } = this.props;
71-
if (!geolocation.equals(prevGeolocation)) {
71+
if (!geolocation?.equals(prevGeolocation)) {
7272
this.getSpacesNearby();
7373
}
7474
if (!spaces.equals(prevSpaces) || searchQuery !== prevSearchQuery) {
@@ -78,7 +78,7 @@ class SpacesNearby extends Component {
7878

7979
getSpacesNearby = () => {
8080
const { dispatchGetSpacesNearby, geolocation } = this.props;
81-
if (!geolocation.isEmpty()) {
81+
if (geolocation && !geolocation.isEmpty()) {
8282
const {
8383
coords: { latitude, longitude },
8484
} = geolocation.toJS();
@@ -130,7 +130,7 @@ class SpacesNearby extends Component {
130130
}
131131

132132
const mapStateToProps = ({ authentication, Space }) => ({
133-
geolocation: authentication.getIn(['user', 'settings', 'geolocation']),
133+
geolocation: authentication.getIn(['user', 'geolocation']),
134134
spaces: Space.getIn(['nearby', 'content']),
135135
activity: Boolean(Space.getIn(['nearby', 'activity']).size),
136136
geolocationEnabled: authentication.getIn([

0 commit comments

Comments
 (0)