From f5c2a75cea4b572bf461509ed05866a777044acb Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 27 Oct 2025 12:34:04 -0500 Subject: [PATCH] Always show clear button when there is content Fixes #175 --- src/components/Search/Search.jsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/Search/Search.jsx b/src/components/Search/Search.jsx index 06d7585..3cba09c 100644 --- a/src/components/Search/Search.jsx +++ b/src/components/Search/Search.jsx @@ -32,9 +32,7 @@ function SearchInner( const [searchValue, setSearchValue] = useControlledOrNot("", value); - const [clearActive, setClearActive] = useState( - isControlled ? searchValue.length > 0 : false - ); + const clearActive = isControlled ? searchValue.length > 0 : false; if (isControlled !== (typeof value !== "undefined")) { throw "Search: Changing from controlled to uncontrolled component and vice versa is not allowed"; @@ -56,7 +54,6 @@ function SearchInner( const handleChange = (e) => { const value = e.target.value; - setClearActive(value.length > 0); if (isControlled === false) { setSearchValue(value); } @@ -68,8 +65,6 @@ function SearchInner( setSearchValue(""); } - setClearActive(false); - onClearClick(); };