Data Layer low complexity Shared Component mobile
0
Dependencies
2
Dependents
3
Entities
0
Integrations

Description

Riverpod provider that exposes the coordinator's peer mentor contact list filtered and ready for use in proxy and bulk selection UIs. Caches the contact list to avoid redundant fetches across the proxy mode selector, single-selector, and multi-select screens within the same session.

Feature: Bulk & Proxy Registration

proxy-contact-list-provider

Summaries

The Proxy Contact List Provider enables coordinators to quickly identify and select peer mentors when registering activities on their behalf, directly improving the speed and accuracy of proxy and bulk registration workflows. By caching the contact list within a session, the application avoids repeated network calls that would slow down the UI and degrade the user experience in low-connectivity environments common to field workers. As a shared component reused across the proxy mode selector, single-selector, and multi-select screens, it reduces duplicated logic and ensures a consistent, reliable contact experience throughout the proxy registration flow. This directly supports operational efficiency and reduces coordinator frustration during high-volume activity entry periods.

This is a low-complexity Riverpod provider with no external service dependencies, making it one of the lower-risk components in the proxy registration feature set. Development effort is primarily in implementing correct cache invalidation logic — ensuring the contact list refreshes when underlying data changes without triggering unnecessary re-fetches. Because it is marked as shared and consumed by at least three screens (proxy mode selector, single-selector, multi-select), any behavioral change or bug fix will have a broader blast radius and requires regression testing across all consuming screens. No backend or database migrations are needed.

The main delivery risk is ensuring cache invalidation timing aligns with the lifecycle of each screen, which requires close coordination with UI developers working on the consuming widgets.

ProxyContactListProvider is a Riverpod provider (likely AsyncNotifierProvider or StreamProvider) that wraps the coordinator's peer mentor contact list and exposes it as reactive state to multiple UI layers. watchCoordinatorMentors(coordinatorId) sets up the primary stream or future, while searchMentors(query) performs client-side filtering over the cached list to avoid redundant API calls during search interactions. refreshContacts() manually invalidates the provider's cache, triggering a fresh fetch — important for pull-to-refresh patterns. getMentorById(mentorId) provides O(1) lookup from the cached list for detail retrieval without a network round-trip.

The component operates exclusively in the mobile execution context. Because it is shared across multiple screens within the same session, the provider's ref.keepAlive() or autoDispose behavior must be carefully configured to balance memory usage against re-fetch cost. No dependencies on other components are declared, implying direct Supabase client or repository access at the provider level.

Responsibilities

  • Fetch and cache coordinator's peer mentor contacts
  • Expose filtered and searchable contact state via Riverpod
  • Invalidate cache on contact list updates

Interfaces

watchCoordinatorMentors(coordinatorId)
searchMentors(query)
refreshContacts()
getMentorById(mentorId)

Relationships

Dependents (2)

Components that depend on this component

Related Data Entities (3)

Data entities managed by this component

API Contract

View full contract →
REST /api/v1/mentor-contacts 5 endpoints
GET /api/v1/mentor-contacts List or search mentors available to a coordinator (searchMentors / watchCoordinatorMentors)
GET /api/v1/mentor-contacts/:id Get full mentor contact details by ID (getMentorById)
POST /api/v1/mentor-contacts Add a mentor to a coordinator's contact list
PUT /api/v1/mentor-contacts/:id Refresh or update a mentor contact entry (refreshContacts)
DELETE /api/v1/mentor-contacts/:id Remove a mentor from a coordinator's contact list