Receive Real-Time Queue Updates Without Manual Refresh
The Approval Queue Screen maintains a Riverpod stream provider subscribed to real-time Supabase changes on the reimbursement_approvals table, scoped to the coordinator's organisation. When another coordinator approves or rejects a submission, it is removed from the queue on all connected coordinator devices simultaneously. When a new submission enters 'pending_attestation', it appears in the queue across all active coordinator sessions. The Approval Repository manages the stream subscription lifecycle, reconnecting automatically after network interruptions and reflecting the last known state during brief connectivity gaps.
User Story
Acceptance Criteria
- Given I have the approval queue screen open, when a colleague approves a submission on their device, then the submission disappears from my queue within 3 seconds without a manual refresh
- Given I have the approval queue open, when a new submission enters 'pending_attestation' status, then it appears in my queue within 3 seconds and is visually distinguished as newly arrived
- Given I lose network connectivity temporarily, when connectivity is restored, then the queue stream reconnects automatically and reflects the current state without requiring me to restart the app
- Given multiple coordinators are viewing the same queue, when one acts on a submission, then the others' queues update to reflect the action preventing duplicate processing
- Given I am on the queue screen and no network is available, when the connection is lost, then an offline indicator is shown rather than silently displaying stale data
Business Value
Without real-time updates, organisations with multiple coordinators risk duplicate processing (two coordinators opening and approving the same submission) or stale queues that show already-resolved items. Real-time synchronisation via Supabase subscriptions is the architectural mechanism that makes concurrent coordinator operation safe and efficient, which is critical for larger organisations.
Components
- Approval Queue Screen ui
- Approval Repository data
- Supabase Edge Function Runtime infrastructure