Form submit
A form that must be submitted once. concurrency: 'drop' ignores a second submit while the first is in flight: first a profile save with rxMutation(), next to the same save written by hand with an Observable, then a payment, where a double click must not charge the card twice. Source: save · pay
Save a display name
Press Enter twice: each save goes to both versions and takes 1.5 s (an artificial delay).
Hand-written
- isSaving()
- false
- savedProfile()
- —
- saveError()
Server
- Nothing yet.
rxMutation()
- status()
- idle
- value()
- —
- error()
- input()
- —
Server
- Nothing yet.
protected readonly saveProfile = rxMutation<string, Profile, ApiError>({
concurrency: 'drop',
mutationFn: (name) => this.mutationServer.saveProfile(name),
});Pay
Double-click "Pay": the button stays enabled on purpose.
- Clicks
- 0
- Default: charges on the server
- 0
- 'drop': charges on the server
- 0
Charged twice by default, once with 'drop'.
protected readonly payDropping = mutation<void, void>({
concurrency: 'drop',
mutationFn: (_input, abortSignal) => this.droppingServer.charge(abortSignal),
});