Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if(query && query.progress === 'new' && query.layers.length > 0) {
// issue a 'started' modification so the query is
// not run twice.
this.props.store.dispatch(mapActions.startQuery(query_id));
// run the query.
this.runQuery(queries, query_id);
}
}
if(queries.order.length > 0) {
const query_id = queries.order[0];
const query = queries[query_id];
if(query.progress === 'finished') {
// check the filters
const filter_json = JSON.stringify(query.filter);
const filter_md5 = md5(filter_json);
if(this.currentQueryId !== query_id
|| this.currentQueryFilter !== filter_md5) {
this.renderQueryLayer(query);
this.currentQueryId = query_id;
this.currentQueryFilter = filter_md5;
}
}
} else {
// once there are no more queries,
// clear the results from the map.
const results = this.props.mapSources.results;
if(results && results.features && results.features.length > 0) {
this.props.store.dispatch(mapSourceActions.clearFeatures('results', 'results'));
}