Skip to content

Introduce HASearchField#7151

Open
TimoPtr wants to merge 1 commit into
mainfrom
feature/ha_search_field
Open

Introduce HASearchField#7151
TimoPtr wants to merge 1 commit into
mainfrom
feature/ha_search_field

Conversation

@TimoPtr

@TimoPtr TimoPtr commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Extracted the debounce search logic within a HASearchField, this was initially made in #6567 by @danielgomezrico. Since I'm currently redoing the EntityPicker I took the opportunity to extract it into a smaller PR. I've also added a small state object and a remember helper on top of tests.

It's built on top of our existing HATextField, it can be extended later.

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines.
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered.
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

Screenshots

image

Any other notes

Based on #7149

@TimoPtr TimoPtr requested a review from jpelgrom July 9, 2026 13:52
@TimoPtr TimoPtr linked an issue Jul 13, 2026 that may be closed by this pull request
@TimoPtr TimoPtr force-pushed the feature/get-entities-for-display-usecase branch from ebb8d64 to 9ff5691 Compare July 15, 2026 09:48
@TimoPtr TimoPtr force-pushed the feature/ha_search_field branch from ae1eaca to 048ca8d Compare July 15, 2026 09:48
@TimoPtr TimoPtr force-pushed the feature/get-entities-for-display-usecase branch from 9ff5691 to 6a124f9 Compare July 16, 2026 06:36
@TimoPtr TimoPtr force-pushed the feature/ha_search_field branch from 048ca8d to 8e2d83b Compare July 16, 2026 06:41
Base automatically changed from feature/get-entities-for-display-usecase to main July 16, 2026 07:27
Copilot AI review requested due to automatic review settings July 16, 2026 08:00
@TimoPtr TimoPtr force-pushed the feature/ha_search_field branch from 8e2d83b to 85fa87a Compare July 16, 2026 08:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request introduces a reusable Compose HASearchField component (built on HATextField) that encapsulates debounced search behavior behind a SearchFieldState, along with interaction and screenshot tests, and a debug-catalog entry to showcase the component.

Changes:

  • Added HASearchField composable and SearchFieldState + rememberSearchFieldState helper to centralize debounced search input behavior.
  • Added Robolectric Compose UI tests validating label/clear-icon behavior and debounce timing semantics.
  • Added screenshot tests (light/dark + with/without leading icon) and wired the component into the debug UI catalog.

Reviewed changes

Copilot reviewed 4 out of 10 changed files in this pull request and generated 1 comment.

File Description
common/src/main/kotlin/io/homeassistant/companion/android/common/compose/composable/HASearchField.kt Adds the debounced search field composable and its state holder/helper.
common/src/test/kotlin/io/homeassistant/companion/android/common/compose/composable/HASearchFieldTest.kt Adds interaction tests for debounce behavior, label visibility, and clearing.
common/src/screenshotTest/kotlin/io/homeassistant/companion/android/compose/composable/HASearchFieldScreenshotTest.kt Adds screenshot coverage for empty/filled states and optional leading icon.
app/src/debug/kotlin/io/homeassistant/companion/android/developer/catalog/HAUserInputScreen.kt Showcases HASearchField in the developer catalog.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce HASearchField

2 participants