Skip to content
Snippets Groups Projects
Commit 2176a892 authored by esikkala's avatar esikkala
Browse files

Clear old results before fetching new results

parent e4bb4563
No related branches found
No related tags found
No related merge requests found
...@@ -81,6 +81,7 @@ const IntegrationAutosuggest = (props) => { ...@@ -81,6 +81,7 @@ const IntegrationAutosuggest = (props) => {
const handleOnSuggestionSelected = () => { const handleOnSuggestionSelected = () => {
console.log('fetching results'); console.log('fetching results');
props.clearResults();
props.fetchResults(); props.fetchResults();
}; };
...@@ -88,6 +89,7 @@ const IntegrationAutosuggest = (props) => { ...@@ -88,6 +89,7 @@ const IntegrationAutosuggest = (props) => {
if (event.key === 'Enter') { if (event.key === 'Enter') {
console.log('fetching results'); console.log('fetching results');
autosuggestDOM.current.input.blur(); autosuggestDOM.current.input.blur();
props.clearResults();
props.fetchResults(); props.fetchResults();
} }
}; };
...@@ -157,6 +159,7 @@ IntegrationAutosuggest.propTypes = { ...@@ -157,6 +159,7 @@ IntegrationAutosuggest.propTypes = {
fetchSuggestions: PropTypes.func.isRequired, fetchSuggestions: PropTypes.func.isRequired,
clearSuggestions: PropTypes.func.isRequired, clearSuggestions: PropTypes.func.isRequired,
fetchResults: PropTypes.func.isRequired, fetchResults: PropTypes.func.isRequired,
clearResults: PropTypes.func.isRequired
}; };
export default withStyles(styles)(IntegrationAutosuggest); export default withStyles(styles)(IntegrationAutosuggest);
...@@ -28,6 +28,7 @@ import { ...@@ -28,6 +28,7 @@ import {
fetchSuggestions, fetchSuggestions,
clearSuggestions, clearSuggestions,
fetchResults, fetchResults,
clearResults,
openDrawer, openDrawer,
closeDrawer, closeDrawer,
setMapReady, setMapReady,
...@@ -153,6 +154,7 @@ let MapApp = (props) => { ...@@ -153,6 +154,7 @@ let MapApp = (props) => {
fetchSuggestions={props.fetchSuggestions} fetchSuggestions={props.fetchSuggestions}
clearSuggestions={props.clearSuggestions} clearSuggestions={props.clearSuggestions}
fetchResults={props.fetchResults} fetchResults={props.fetchResults}
clearResults={props.clearResults}
/> />
{props.search.results.length > 0 && {props.search.results.length > 0 &&
<SimpleTable data={props.search.results} /> <SimpleTable data={props.search.results} />
...@@ -239,6 +241,7 @@ const mapDispatchToProps = ({ ...@@ -239,6 +241,7 @@ const mapDispatchToProps = ({
fetchSuggestions, fetchSuggestions,
clearSuggestions, clearSuggestions,
fetchResults, fetchResults,
clearResults,
setMapReady, setMapReady,
getGeoJSON getGeoJSON
}); });
...@@ -256,6 +259,7 @@ MapApp.propTypes = { ...@@ -256,6 +259,7 @@ MapApp.propTypes = {
fetchSuggestions: PropTypes.func.isRequired, fetchSuggestions: PropTypes.func.isRequired,
clearSuggestions: PropTypes.func.isRequired, clearSuggestions: PropTypes.func.isRequired,
fetchResults: PropTypes.func.isRequired, fetchResults: PropTypes.func.isRequired,
clearResults: PropTypes.func.isRequired,
setMapReady: PropTypes.func.isRequired, setMapReady: PropTypes.func.isRequired,
geoJSON: PropTypes.object.isRequired, geoJSON: PropTypes.object.isRequired,
geoJSONKey: PropTypes.number, geoJSONKey: PropTypes.number,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment