diff options
| author | Adam Malczewski <[email protected]> | 2026-06-01 11:34:40 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-01 11:34:40 +0900 |
| commit | f60aceec5fd77bbd1efcdfc2c907dd4e61a00469 (patch) | |
| tree | 78458036776c63e2524683e3c1265fd0e3d6ccfb /packaging | |
| parent | 1210d6257a60ab859425557274b58d8c9ec3f2fa (diff) | |
| download | dispatch-f60aceec5fd77bbd1efcdfc2c907dd4e61a00469.tar.gz dispatch-f60aceec5fd77bbd1efcdfc2c907dd4e61a00469.zip | |
fix(frontend): ClaudeReset — global mutation lock + explicit action intent
Round-2 Gemini review found that the SnapshotSequencer's 'most-recent
client seq wins' rule only protects against RESPONSE reordering. If the
network reorders the REQUESTS themselves (B reaches the server before
A), the server's snapshot reflecting the true final state may carry the
older client seq and get discarded — UI permanently desyncs.
Two related fixes:
1. Replace pendingHours: Set<number> (per-hour lock) with a single
pendingHour: number | null (global mutation lock). All 24 toggle
buttons go disabled while any POST is in flight. This serializes
mutations on the wire, eliminating the request-reorder failure mode
entirely.
2. Send the action explicitly. toggleHour now derives 'on' or 'off' from
its local state and passes it to postToggle, which sends it on the
wire. Pairs with the matching backend contract change — the server
no longer guesses from its own state, so even if a stale UI made it
through it would just be an idempotent no-op or timestamp refresh
instead of an inverted click.
The SnapshotSequencer is retained — it still guards the GET-on-mount
vs first-click race (where the two requests are NOT both mutations and
the global lock doesn't apply).
UX note: per-hour 'cursor: wait' visual is preserved for the hour whose
request is in flight (so the user can see which click is pending),
while the OTHER hours go merely disabled (no cursor change) — a clearer
'busy' signal than dimming everything uniformly.
svelte-check: 0 errors, 0 warnings. 431 / 431 tests pass.
Diffstat (limited to 'packaging')
0 files changed, 0 insertions, 0 deletions
