Service Layer high complexity mobile
2
Dependencies
3
Dependents
4
Entities
0
Integrations

Description

Applies writes immediately to the local Drift store so the UI remains responsive without waiting for server confirmation. Registers a rollback hook in the Riverpod state layer that re-fetches the authoritative record and notifies the UI when the server rejects the mutation.

Feature: Offline Data Support

optimistic-update-service

Responsibilities

  • Apply optimistic mutations to local database within a Drift transaction
  • Register per-mutation rollback hooks in the Riverpod provider layer
  • Trigger UI re-render with authoritative server data on rejection
  • Coordinate with the Mutation Outbox to mark mutations as rolled back

Interfaces

applyOptimistic(entityType, payload): Future<void>
registerRollback(mutationId, rollbackFn): void
rollback(mutationId): Future<void>
onServerRejection(mutationId): Future<void>

Relationships

Dependencies (2)

Components this component depends on

Dependents (3)

Components that depend on this component