Skip to content

refactor: convert FieldValueToggleFilter to function component#9522

Open
CollegeRideOut wants to merge 3 commits intoelastic:mainfrom
CollegeRideOut:field-value-toggle-filter-function
Open

refactor: convert FieldValueToggleFilter to function component#9522
CollegeRideOut wants to merge 3 commits intoelastic:mainfrom
CollegeRideOut:field-value-toggle-filter-function

Conversation

@CollegeRideOut
Copy link

Summary

Convert FieldValueToggleFilter from a class component to a stateless function component.

  • Refactored to use FC<FieldValueToggleFilterProps> style
  • Stateless render-only; no functional changes
  • Prettier formatting applied

API Changes

None — this is an internal component and its API hasn’t changed.

Screenshots

Not applicable — no visual changes.

Impact Assessment

  • 🔴 Breaking changes — None
  • 💅 Visual changes — None
  • 🧪 Test impact — All existing tests pass
  • 🔧 Hard to integrate — N/A

Impact level: 🟢 None

Release Readiness

  • Documentation — N/A
  • Figma — N/A
  • Migration guide — N/A
  • Adoption plan — N/A

QA instructions for reviewer

  • Verify the FieldValueToggleFilter behaves as before in Storybook and any demo pages
  • Confirm that toggling the filter updates the query as expected

Checklist before marking Ready for Review

  • Filled out all sections above
  • QA: Verified light/dark mode, accessibility, keyboard navigation
  • Tests: Existing Jest/Cypress tests pass
  • Changelog: Not needed (internal component)
  • Breaking changes: None

@CollegeRideOut CollegeRideOut requested a review from a team as a code owner March 21, 2026 00:13
@cla-checker-service
Copy link

cla-checker-service bot commented Mar 21, 2026

💚 CLA has been signed

@github-actions
Copy link

👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually?

@github-actions github-actions bot added the community contribution (Don't delete - used for automation) label Mar 21, 2026
@weronikaolejniczak
Copy link
Contributor

buildkite test this

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the internal FieldValueToggleFilter search bar filter from a class component to a stateless function component, aiming to keep behavior the same while modernizing the implementation.

Changes:

  • Converted FieldValueToggleFilter from Component to FC<FieldValueToggleFilterProps>.
  • Moved class methods (resolveDisplay, valueChanged) to local arrow functions within the function component.
  • Applied formatting updates (though a few formatting/style issues remain in the diff).
Comments suppressed due to low confidence (1)

packages/eui/src/components/search_bar/filters/field_value_toggle_filter.tsx:78

  • The component export ends with } instead of };, and there are multiple trailing blank lines at EOF. Please run prettier/formatting (or manually adjust) to match the conventions in other filters (single newline at EOF, semicolons where expected).
  );
}






💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community contribution (Don't delete - used for automation)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants