Skip to content

Commit ff6a9fe

Browse files
houhoucoopderekbit
authored andcommitted
fix: trim input value
Signed-off-by: Yi-Ya Chen <[email protected]>
1 parent eca97fc commit ff6a9fe

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/components/Filter/Filter.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class Filter extends React.Component {
3939

4040
handleSubmit = () => {
4141
if (this.props.onSearch) {
42-
this.props.onSearch(Object.assign({}, this.state))
42+
this.setState(
43+
(prevState) => ({ value: prevState.value.trim() }),
44+
() => this.props.onSearch({ ...this.state })
45+
)
4346
}
4447
}
4548

0 commit comments

Comments
 (0)