Skip to content

Move filter clear button to header with round × icon#97

Merged
einari merged 6 commits into
mainfrom
copilot/move-clear-button-for-filters
Jun 4, 2026
Merged

Move filter clear button to header with round × icon#97
einari merged 6 commits into
mainfrom
copilot/move-clear-button-for-filters

Conversation

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Relocated clear button from filter content area to header, positioned next to the active selection count badge. Button is now a round × icon with tooltip, consistent across all filter types.

Changed

  • Filter clear buttons now appear in header next to count badge/indicator, not at bottom of filter content (#issue)
  • Clear button styled as round icon with × character, hover/active states, and descriptive tooltips (#issue)
  • RangeHistogramFilter no longer renders its own clear button—handled by parent FilterPanel (#issue)
  • Custom filter examples updated to remove inline clear buttons following new pattern (#issue)
  • Documentation updated with clear button behavior for all filter types and guidance for custom editors (#issue)

Implementation

FilterPanel.tsx: Clear buttons conditionally rendered in header for all filter types:

  • String/option filters: next to selection count, calls onFilterClear(filterKey)
  • Range filters: next to "Range" indicator, calls onRangeChange(filterKey, null)
  • Custom filters: next to dot indicator, calls onCustomValueChange(filterKey, undefined)

CSS: .pv-filter-clear-header with circular shape, transitions, and accessibility attributes.

Specs: Four specification files document expected behavior (when buttons appear, what actions they trigger, tooltip text).

Copilot AI linked an issue Jun 4, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Move clear button for filters to the header Move filter clear button to header with round × icon Jun 4, 2026
Copilot finished work on behalf of einari June 4, 2026 13:41
Copilot AI requested a review from einari June 4, 2026 13:41
einari added 3 commits June 4, 2026 17:41
The applyThemeLink function was directly assigning to link.href property,
which triggered Vite's reactivity system and caused the browser to hang/crash.
Replace with setAttribute() to avoid HMR loops and ensure stable page loads.
Resolves 'command not found: storybook' error when running yarn dev.
Use npx to resolve storybook from node_modules/.bin/
Resolved browser crash caused by infinite React render loops when
viewing FilterPanel stories in Storybook.

Root causes:
- Filter arrays defined inline in stories created new references on
  every render
- useFilterState hook had filters array in useEffect dependency,
  triggering on every reference change
- buildEditorMap() called on every render without memoization

Fixes applied:
- useFilterState: Added key serialization to detect actual filter
  changes vs reference changes
- FilterPanel: Memoized editorMap with useMemo
- All stories: Wrapped filter definitions with useMemo for stable
  references

All FilterPanel story variants now load and interact correctly without
crashing.
@einari einari marked this pull request as ready for review June 4, 2026 16:40
@einari einari merged commit c3b1dd6 into main Jun 4, 2026
7 checks passed
@einari einari deleted the copilot/move-clear-button-for-filters branch June 4, 2026 16:41
@einari einari added the patch label Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Move Clear button for filters

2 participants