Skip to content

Commit e82fc87

Browse files
author
Andrei Alexandru
committed
autocomplete initial results
1 parent e6f91f0 commit e82fc87

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

views/src/components/DepartmentsAutocomplete.jsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const mapStateToProps = state => {
2828
}
2929

3030
class DepartmentsAutocomplete extends Component {
31+
componentDidMount(){
32+
this.props.searchChanged('');
33+
this.props.handleBlur();
34+
}
35+
3136
render() {
3237
const props = this.props,
3338
items = props.items,
@@ -57,8 +62,8 @@ DepartmentsAutocomplete.propTypes = {
5762
value: PropTypes.string,
5863
items: PropTypes.array,
5964
suggestionsVisible: PropTypes.bool,
65+
searchChanged: PropTypes.func,
6066
selectedChanged: PropTypes.func,
6167
handleFocus: PropTypes.func,
6268
handleBlur: PropTypes.func
63-
6469
}

views/src/components/ProductsAutocomplete.jsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ const mapStateToProps = state => {
2828
}
2929

3030
class ProductsAutocomplete extends Component {
31+
componentDidMount() {
32+
this.props.searchChanged('');
33+
this.props.handleBlur();
34+
}
35+
3136
render() {
3237
const props = this.props,
3338
items = props.items,
@@ -57,6 +62,7 @@ ProductsAutocomplete.propTypes = {
5762
value: PropTypes.string,
5863
items: PropTypes.array,
5964
suggestionsVisible: PropTypes.bool,
65+
searchChanged: PropTypes.func,
6066
selectedChanged: PropTypes.func,
6167
handleFocus: PropTypes.func,
6268
handleBlur: PropTypes.func

views/src/reducers/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ const initialState = {
3737
items: [],
3838
search: '',
3939
selected: '',
40-
suggestionsVisible: true,
40+
suggestionsVisible: false,
4141
products: {
4242
items: [],
4343
search: '',
4444
selected: {},
45-
suggestionsVisible: true
45+
suggestionsVisible: false
4646
}
4747
},
4848
notifications: {

0 commit comments

Comments
 (0)