Files
TX/artifacts
riyadhafraa 4a9ca4bd4a tx-os #317: optimistic-cache saves for all inline editors
Extends the optimistic React Query cache pattern (proven in #316 for the
schedule time cell) to every other inline editor on executive-meetings.tsx,
fixing the "تأخير في الاستجابة وأحياناً ما يحفظ" regression where typed
edits felt sluggish or appeared to silently drop.

executive-meetings.tsx
  * New `applyMeetingPatch(meetingId, patch)` helper: snapshots the day's
    DayResponse, applies a per-meeting patch via setQueryData, and returns
    a rollback closure that re-sets the snapshot on PATCH failure.
  * `saveTitle`, `saveAttendeeName`, `saveMerge`, and `setRowColor` now
    write the optimistic value before awaiting the network call and
    rollback() in their catch branches.

editable-cell.tsx (3-layer blur hardening)
  1. saveEdit() failure now re-opens the editor with the user's typed
     draft preserved (mirrors #316 time-cell UX) so a server error never
     forces them to retype. The parent's optimistic cache rollback
     restores the read-only `value`; the editor itself still holds the
     draft, so flipping `editing` back on is enough.
  2. Outside-pointerdown now flushes saveEdit synchronously (capture
     phase, before the click reaches its target) instead of waiting on
     the 100 ms blur timer. Closes the gap where a fast click into
     another cell triggered a row remount before blur fired.
  3. Unmount cleanup flushes any pending blurTimerRef fire-and-forget,
     a final safety net for the case where a refetch tears down the
     row before any pointer event arrives.

editable-cell.tsx (re-entrancy guard)
  * `savingRef` short-circuits a second `saveEdit` call so the
    pointerdown flush + the 100 ms blur timer + Enter/Tab handlers
    can't race and issue duplicate PATCH/PUT requests for one edit.

tests/executive-meetings-keyboard-editing.spec.mjs (+5 tests)
  * Title repaint <300 ms with PATCH delayed 1500 ms.
  * Title PATCH 500 rolls back; editor re-opens with the typed draft
    intact; Escape cancels back to the original; DB unchanged.
  * Rapid click-switch from cell A to cell B commits BOTH PATCHes to
    the server (proves the synchronous outside-pointerdown flush).
  * Rapid Tab traversal from cell A to cell B commits BOTH edits
    EXACTLY ONCE each (proves the savingRef re-entrancy guard).
  * Attendee-name PUT delayed 1500 ms repaints in <300 ms (uses
    captured testid so the locator survives the rename).

All 5 new + 3 #316 time-editor tests green. Out-of-scope pre-existing
failures in the `test` workflow (notifications/postpone-race/row-color)
left untouched per plan.
2026-05-03 07:45:30 +00:00
..
2026-04-18 02:00:09 +00:00