🔍 fix(pricing): synchronize search term with sidebar filters & reset behavior
* Add `searchValue` to every dependency array in `usePricingFilterCounts` to ensure group/vendor/tag counts and disabled states update dynamically while performing fuzzy search. * Refactor `PricingTopSection` search box into a controlled component: - Accept `searchValue` prop and bind it to `Input.value` - Extend memo dependencies to include `searchValue` This keeps the UI in sync with state changes triggered by `handleChange`. * Guarantee that `resetPricingFilters` clears the search field by leveraging the new controlled input. As a result, sidebar counters/disabled states now react to search input, and the “Reset” button fully restores default filters without leaving the search term visible.
This commit is contained in:
@@ -35,6 +35,7 @@ const PricingTopSection = ({
|
||||
models,
|
||||
filteredModels,
|
||||
loading,
|
||||
searchValue,
|
||||
t
|
||||
}) => {
|
||||
const [showFilterModal, setShowFilterModal] = useState(false);
|
||||
@@ -46,6 +47,7 @@ const PricingTopSection = ({
|
||||
<Input
|
||||
prefix={<IconSearch />}
|
||||
placeholder={t('模糊搜索模型名称')}
|
||||
value={searchValue}
|
||||
onCompositionStart={handleCompositionStart}
|
||||
onCompositionEnd={handleCompositionEnd}
|
||||
onChange={handleChange}
|
||||
@@ -78,7 +80,7 @@ const PricingTopSection = ({
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
), [selectedRowKeys, t, handleCompositionStart, handleCompositionEnd, handleChange, copyText, isMobile]);
|
||||
), [selectedRowKeys, t, handleCompositionStart, handleCompositionEnd, handleChange, copyText, isMobile, searchValue]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user