Skip to content

Commit

Permalink
Merge branch 'develop' into prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
nrotstan committed Dec 6, 2019
2 parents 0ef9e18 + 1aabe80 commit e013788
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/components/ChallengePane/ChallengePane.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ export class ChallengePane extends Component {
criteria={{boundingBox: fromLatLngBounds(this.state.bounds),
zoom: this.state.zoom,
filters: _get(this.props, 'searchCriteria.filters'),
searchQuery: _get(this.props, 'searchCriteria.query'),
challengeStatus}}
updateTaskFilterBounds={(bounds, zoom, fromUserAction) => {
this.props.updateChallengeSearchMapBounds(bounds, fromUserAction)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import _uniqueId from 'lodash/uniqueId'
import _sum from 'lodash/sum'
import _map from 'lodash/map'
import _set from 'lodash/set'
import _debounce from 'lodash/debounce'
import { fromLatLngBounds,
boundsWithinAllowedMaxDegrees } from '../../../services/MapBounds/MapBounds'
import { fetchTaskClusters } from '../../../services/Task/TaskClusters'
Expand Down Expand Up @@ -134,8 +135,14 @@ export const WithChallengeTaskClusters = function(WrappedComponent, storeTasks=f
}
}

debouncedFetchClusters =
_debounce((showAsClusters) => this.fetchUpdatedClusters(showAsClusters), 400)

componentDidUpdate(prevProps, prevState) {
if (!_isEqual(_omit(prevProps.criteria, ['page', 'pageSize']),
if (!_isEqual(_get(prevProps.criteria, 'searchQuery'), _get(this.props.criteria, 'searchQuery'))) {
this.debouncedFetchClusters(this.state.showAsClusters)
}
else if (!_isEqual(_omit(prevProps.criteria, ['page', 'pageSize']),
_omit(this.props.criteria, ['page', 'pageSize']))) {
this.fetchUpdatedClusters(this.state.showAsClusters)
}
Expand Down

0 comments on commit e013788

Please sign in to comment.