diff --git a/src/components/tag-filter/__tests__/tag-filter.test.tsx b/src/components/tag-filter/__tests__/tag-filter.test.tsx index 76ff26339..f2b39b19b 100644 --- a/src/components/tag-filter/__tests__/tag-filter.test.tsx +++ b/src/components/tag-filter/__tests__/tag-filter.test.tsx @@ -88,17 +88,6 @@ describe(TagFilter.name, () => { expect(mockOnChangeValues).toHaveBeenCalledWith([]); }); - it('automatically toggles to "show all" (empty array) when the last tag is clicked and all tags become selected', async () => { - const { user, mockOnChangeValues } = setup({ - values: ['opt1', 'opt2'], - }); - - // Click the last tag to select all tags - should auto-toggle to empty array - await user.click(screen.getByText('Option 3')); - - expect(mockOnChangeValues).toHaveBeenCalledWith([]); - }); - it('does not render "Show all" tag when hideShowAll is true', () => { setup({ hideShowAll: true, diff --git a/src/components/tag-filter/tag-filter.tsx b/src/components/tag-filter/tag-filter.tsx index 2a92a72c6..b7ada4adf 100644 --- a/src/components/tag-filter/tag-filter.tsx +++ b/src/components/tag-filter/tag-filter.tsx @@ -24,18 +24,13 @@ export default function TagFilter({ const isShowAll = useMemo(() => values.length === 0, [values]); const onChangeSingleValue = useCallback( - (value: T) => { - const newValues = values.includes(value) - ? values.filter((v) => v !== value) - : [...values, value]; - - // If all tags are selected, automatically toggle to "show all" (empty array) - const areAllTagsSelected = tagKeys.every((key) => - newValues.includes(key) - ); - onChangeValues(areAllTagsSelected ? [] : newValues); - }, - [values, onChangeValues, tagKeys] + (value: T) => + onChangeValues( + values.includes(value) + ? values.filter((v) => v !== value) + : [...values, value] + ), + [values, onChangeValues] ); return (