Search Contacts and Peer Mentors by Name or Attribute
The contact search feature must provide a debounced search bar at the top of the contact list that queries both the online Supabase backend and a local offline cache. Search results must update as the user types, with a configurable debounce delay to avoid excessive API calls. The search must respect the same RLS policies as the main list, ensuring coordinators only find contacts within their chapter. Offline mode must degrade gracefully by searching the local cache.
User Story
Acceptance Criteria
- Given I am on the contact list screen, when I tap the search bar and type at least 2 characters, then the list filters to show matching contacts within 400ms
- Given I am searching for a contact, when the search debounce triggers, then only one API call is made per debounce interval rather than one call per keystroke
- Given I am offline, when I search for a contact, then the search queries the local offline cache and displays cached results with an offline indicator
- Given search results are displayed, when I tap a result, then I am navigated to the contact detail screen for that contact
- Given I clear the search bar, when the input is empty, then the full contact list is restored without requiring a manual reload
Business Value
Coordinators managing dozens to hundreds of contacts cannot rely on manual scrolling when time-sensitive situations arise, such as finding an available peer mentor for an urgent assignment. Real-time debounced search with offline fallback ensures productivity is maintained regardless of network conditions, directly reducing response time for contact matching and assignment.
Components
- Contact List Screen ui
- Contact Search Bar ui
- Contact Search Service service
- Contact Search Screen ui
- Accessible Search Input Field ui
- Search Results List ui
- Contact Search Service service
- Supabase Contact Search Repository data
- Offline Contact Search Repository data
- Contact Cache Sync Repository data
- Search Debounce Utility infrastructure