Skip to content

fix(web): keep event color responsive during optimistic replace - #2744

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/fix-allday-color-flash-2e58
Aug 10, 2026
Merged

fix(web): keep event color responsive during optimistic replace#2744
cursor[bot] merged 2 commits into
mainfrom
cursor/fix-allday-color-flash-2e58

Conversation

@tyler-dane

Copy link
Copy Markdown
Contributor

Summary

Changing an event’s color (context menu or form save) discarded the grid draft before replace’s async optimistic cache write finished, so the card briefly flashed the old color. This mirrors create’s onOptimisticApplied teardown for replace.

Changes

  • Pass callbacks on replace mutation variables so onOptimisticApplied runs in the same task as the optimistic cache write
  • useSetEventColor: paint the new color on the draft immediately, discard only via onOptimisticApplied
  • useSaveEventForm edit path: close via onOptimisticApplied (same as create)
  • Clear preserved colorHex on optimistic replace when a slot color is written, so custom-hex events don’t keep the old fill

Test plan

  • bun test:web on useEventMutations, useSetEventColor, and useSaveEventForm tests
  • Manually: Week all-day right-click color change — no flash to old color
  • Manually: Form color change + save — no flash to old color
Open in Web Open in Cursor 

cursoragent and others added 2 commits August 10, 2026 20:32
Discard grid drafts only after replace's optimistic cache write, matching
create's onOptimisticApplied pattern, so color changes no longer flash
the previous color while cancelQueries awaits.

Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
Reuse patchGridDraftFields for color patches, drop colorHex before merge,
and trim redundant test scaffolding.

Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
@cursor
cursor Bot marked this pull request as ready for review August 10, 2026 20:51
@cursor
cursor Bot merged commit 7ad2934 into main Aug 10, 2026
19 of 20 checks passed
@cursor
cursor Bot deleted the cursor/fix-allday-color-flash-2e58 branch August 10, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants