From bb5b3629445ed6a52c3a088dbc2dd08b7a326f8a Mon Sep 17 00:00:00 2001 From: Noah Loomans Date: Thu, 14 Dec 2017 16:24:10 +0100 Subject: Remove input value from redux --- src/client/react/components/container/Search.jsx | 4 ---- src/client/react/reducers/search.js | 2 -- src/client/react/reducers/search.test.js | 4 ---- 3 files changed, 10 deletions(-) diff --git a/src/client/react/components/container/Search.jsx b/src/client/react/components/container/Search.jsx index babe0c4..e49e6a7 100644 --- a/src/client/react/components/container/Search.jsx +++ b/src/client/react/components/container/Search.jsx @@ -54,7 +54,6 @@ class Search extends React.Component { render() { const { - value, selectedResult, isExactMatch, dispatch, @@ -77,7 +76,6 @@ class Search extends React.Component { id="search__input" onChange={event => dispatch(inputChange(event.target.value))} onKeyDown={this.onKeyDown} - value={value} placeholder="Zoeken" onFocus={this.onFocus} onBlur={this.onBlur} @@ -90,7 +88,6 @@ class Search extends React.Component { } Search.propTypes = { - value: PropTypes.string.isRequired, selectedResult: PropTypes.string, isExactMatch: PropTypes.bool.isRequired, dispatch: PropTypes.func.isRequired, @@ -102,7 +99,6 @@ Search.defaultProps = { const mapStateToProps = state => ({ results: state.search.results, - value: state.search.input, selectedResult: state.search.selectedResult, isExactMatch: state.search.isExactMatch, }); diff --git a/src/client/react/reducers/search.js b/src/client/react/reducers/search.js index 29d0e5c..2a7e7a5 100644 --- a/src/client/react/reducers/search.js +++ b/src/client/react/reducers/search.js @@ -2,7 +2,6 @@ import fuzzy from 'fuzzy'; import users from '../users'; const DEFAULT_STATE = { - input: '', results: [ 's/18562', ], @@ -41,7 +40,6 @@ const search = (state = DEFAULT_STATE, action) => { return { ...state, - input: action.typedValue, results, selectedResult, isExactMatch, diff --git a/src/client/react/reducers/search.test.js b/src/client/react/reducers/search.test.js index 13f79d2..e0ca18e 100644 --- a/src/client/react/reducers/search.test.js +++ b/src/client/react/reducers/search.test.js @@ -19,7 +19,6 @@ describe('reducers', () => { describe('SEARCH/INPUT_CHANGE', () => { it('Returns no results when nothing is typed in', () => { expect(search(undefined, inputChange(''))).toEqual({ - input: '', results: [], selectedResult: null, isExactMatch: false, @@ -28,7 +27,6 @@ describe('reducers', () => { it('Returns no results when a space is typed in', () => { expect(search(undefined, inputChange(' '))).toEqual({ - input: ' ', results: [], selectedResult: null, isExactMatch: false, @@ -37,7 +35,6 @@ describe('reducers', () => { it('Preforms a basic search, only returning four results', () => { expect(search(undefined, inputChange('18'))).toEqual({ - input: '18', results: [ 's/18561', 's/18562', @@ -51,7 +48,6 @@ describe('reducers', () => { it('Selects the first result and sets isExactMatch to true when there is an exact match', () => { expect(search(undefined, inputChange('18561'))).toEqual({ - input: '18561', results: [ 's/18561', ], -- cgit v1.1