From 0210306fe25cc7c85e81f26cbedd81d4d0542889 Mon Sep 17 00:00:00 2001 From: Yi-Ya Chen Date: Wed, 26 Feb 2025 12:54:16 +0800 Subject: [PATCH] fix: trim input value Signed-off-by: Yi-Ya Chen --- src/components/Filter/Filter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Filter/Filter.js b/src/components/Filter/Filter.js index 0b7d459f5..5c14abaf0 100644 --- a/src/components/Filter/Filter.js +++ b/src/components/Filter/Filter.js @@ -39,7 +39,10 @@ class Filter extends React.Component { handleSubmit = () => { if (this.props.onSearch) { - this.props.onSearch(Object.assign({}, this.state)) + this.setState( + (prevState) => ({ value: prevState.value.trim() }), + () => this.props.onSearch({ ...this.state }) + ) } }