API Reference
replay()
Drains one store's offline write queue back to the server — fire_and_forget for one store, replayAll() for every registered queue at once. Web Locks protected, cooldown guarded, and scoped to the right tenant automatically.
Prerequisites
- A store registered with queueConfig — see api/register
- core-concepts/offline-queue for how entries get queued in the first place
1
Basic usage
flux.replay(channel) drains one store's queue. flux.replayAll() drains every registered store's queue in one call — it's also exactly what runs automatically on the leader tab right after a successful bootstrap().typescript
2
You rarely need to call this yourself
Replay is wired into a set of automatic triggers already. Manual calls are for the cases those triggers don't cover — a "retry now" button in your own offline or conflict UI, for instance.
typescript
3
Locking and run guards
Every replay run is protected by a Web Lock scoped per store, so two open tabs can never both replay the same queue at once. Two additional guards sit on top of the lock to stop redundant runs when several triggers fire close together.
typescript
4
Which strategy actually runs
replay() doesn't choose a strategy — it executes whichever one you configured on that store's queueConfig.replayStrategy at registration time.typescript
Full contract lives elsewhere
Conflict routing, onConflict decisions, and the universal conflict register are covered end-to-end in core-concepts/conflict-resolution.
5
Scoped replay
The tenant filter always comes from the target store's own registered scope — never from whichever user happens to be logged in at the moment
replay() is called. This is what keeps a 'global'-scoped queue (a public waitlist, say) replaying correctly regardless of session state.typescript
6
Cancellation on session teardown
Replay calls are threaded with the engine's per-scope
AbortController. If clearUserSession() fires while a 'user'-scoped replay is mid-flight, that fetch is cancelled immediately rather than completing against a session that's already been torn down.typescript
7
Clock skew correction
For handshake-strategy stores, every queued entry's timestamp is corrected before it's sent, so a device with a drifting clock doesn't produce false-positive conflicts against the server.
typescript
For configuring how a store's queue behaves before it's ever replayed, see api/register. For resolving conflicts a handshake replay surfaces, see api/resolve-unified-conflict.