Skip to content

fix: debounce search inputs and expand dive search to all related fields#55

Merged
ericgriffin merged 3 commits into
mainfrom
fix/search-spinner-churn
Mar 22, 2026
Merged

fix: debounce search inputs and expand dive search to all related fields#55
ericgriffin merged 3 commits into
mainfrom
fix/search-spinner-churn

Conversation

@ericgriffin

@ericgriffin ericgriffin commented Mar 22, 2026

Copy link
Copy Markdown
Member

Add DebouncedSearchResults widget that debounces queries (300ms) and shows cached results during loading instead of a full-screen spinner. Applied to all 7 search screens: sites, buddies, equipment, dive centers, dives, buddy picker, and species picker.

Expand dive search to match across site name/country/region, dive center name, linked buddy names, tags, custom fields, notes, buddy, and dive master using a single SQL query with LEFT JOINs.

Closes #53

Test Plan

  • flutter test passes
  • flutter analyze passes
  • Manual testing on: macOS

Add DebouncedSearchResults widget that debounces queries (300ms) and
shows cached results during loading instead of a full-screen spinner.
Applied to all 7 search screens: sites, buddies, equipment, dive
centers, dives, buddy picker, and species picker.

Expand dive search to match across site name/country/region, dive
center name, linked buddy names, tags, custom fields, notes, buddy,
and dive master using a single SQL query with LEFT JOINs.

Closes #53
Copilot AI review requested due to automatic review settings March 22, 2026 05:42

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 PR addresses search UX “spinner churn” by introducing a debounced, cached-results search widget and applying it across multiple search experiences. It also expands dive log search to match across more related data (sites/centers/buddies/tags/custom fields) using a single SQL query with LEFT JOINs.

Changes:

  • Added DebouncedSearchResults widget to debounce queries (300ms) and keep last successful results visible during loading.
  • Updated multiple search delegates/screens to use the new debounced/cached-results behavior.
  • Expanded searchDives SQL to search across dive-related tables/fields via a consolidated JOIN-based query.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
lib/shared/widgets/debounced_search_results.dart New reusable widget implementing debounce + cached-results loading UI for Riverpod-backed searches.
lib/features/marine_life/presentation/widgets/species_picker_dialog.dart Adds local debounced query state and cached-results loading UI in the species picker dialog.
lib/features/equipment/presentation/widgets/equipment_list_content.dart Switches equipment search delegate to DebouncedSearchResults.
lib/features/dive_sites/presentation/widgets/site_list_content.dart Switches site search delegate to DebouncedSearchResults.
lib/features/dive_log/presentation/pages/dive_list_page.dart Switches dive search delegate to DebouncedSearchResults.
lib/features/dive_log/data/repositories/dive_repository_impl.dart Expands dive search query to match across related tables/fields using JOINs.
lib/features/dive_centers/presentation/widgets/dive_center_list_content.dart Switches dive center search delegate to DebouncedSearchResults.
lib/features/buddies/presentation/widgets/buddy_picker.dart Adds local debounced query state and cached-results loading UI in the buddy picker sheet.
lib/features/buddies/presentation/widgets/buddy_list_content.dart Switches buddy search delegate to DebouncedSearchResults.

Comment thread lib/shared/widgets/debounced_search_results.dart Outdated
Comment thread lib/shared/widgets/debounced_search_results.dart
Comment thread lib/features/marine_life/presentation/widgets/species_picker_dialog.dart Outdated
Comment thread lib/features/buddies/presentation/widgets/buddy_picker.dart
Comment thread lib/features/dive_log/data/repositories/dive_repository_impl.dart Outdated
Comment thread lib/features/dive_log/data/repositories/dive_repository_impl.dart
Comment thread lib/shared/widgets/debounced_search_results.dart
@codecov

codecov Bot commented Mar 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.52880% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
..._sites/presentation/widgets/site_list_content.dart 0.00% 19 Missing ⚠️
...ve_log/data/repositories/dive_repository_impl.dart 96.29% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

ericgriffin and others added 2 commits March 22, 2026 02:30
…eanup, tests

Clear debounced query immediately on empty input instead of waiting
for the timer, add emptyQueryBuilder for screens that show a prompt
on empty queries, simplify the diver filter clause to avoid an
unnecessary subquery, and add widget tests for DebouncedSearchResults
and repository tests for the expanded dive search joins.
Cover the debounce search logic, cached results during loading,
clear-button reset, category filtering, and selection management
in both widgets to bring codecov/patch coverage above the 80% target.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ericgriffin
ericgriffin merged commit 4d1d624 into main Mar 22, 2026
14 checks passed
@ericgriffin
ericgriffin deleted the fix/search-spinner-churn branch March 22, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search screens (buddy, site, others) get stuck if typing too fast

2 participants