Skip to content

fix(sync,web): clear remaining event-color optimistic risks - #2749

Merged
cursor[bot] merged 3 commits into
mainfrom
cursor/clear-event-color-optimistic-risks-8aa4
Aug 10, 2026
Merged

fix(sync,web): clear remaining event-color optimistic risks#2749
cursor[bot] merged 3 commits into
mainfrom
cursor/clear-event-color-optimistic-risks-8aa4

Conversation

@tyler-dane

@tyler-dane tyler-dane commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #2744 / v1.1.181. Clears the two remaining optimistic color risks without reworking the shipped draft/onOptimisticApplied color path.

Risk 1 — colorHex rehydrates after settle

  • mergeUpdateContent: slot writes drop provider colorHex; clearing a prior slot does too. Hex-only events that receive draft color: null keep colorHex (avoids wiping labels on unrelated edits/drags).
  • Google writer: setting a slot color uses a two-step patch — clear eventLabelId under eventLabelVersion=1, then write colorId at default v0 (Google ignores colorId under v1).
  • useSetEventColor: picking the same slot still writes when a lingering colorHex is winning the palette.

Risk 2 — drag/resize early draft discard

Reuse existing onOptimisticApplied plumbing so covering drafts stay up until the optimistic cache write lands:

  • Week / Day interaction coordinators
  • useDraftActions UPDATE submit
  • keyboard nudge shortcuts via useUpdateEvent callbacks
  • replace returns whether the mutation started; blocked/no-op paths still tear down covering drafts

Simplification

Kept discard teardown on the existing onOptimisticApplied callback (including blocked paths) instead of adding a second callback. Google label clear is a dedicated preconditioned patch rather than overloading googleColorIdFields.

Validation

  • bun test:sync:fast / focused Google writer + merge tests
  • bun test:web focused: useUpdateEvent, useSetEventColor, useEventMutations, Day interaction
  • Browser smoke at http://localhost:9080: create timed event, drag 2–4pm → 5–7pm, resize to 5–8pm — settled with no flash-back; no critical console errors
  • bun run type-check, bun run lint
  • Independent review: fixed confirmed Google label-clear / stuck-draft findings

Independent review

Addressed: two-step Google label clear; discard when replace/update never mutates. Residual: intentional hex-only + color: null still preserves colorHex by design to avoid draft null wiping labels.

Open in Web Open in Cursor 

cursoragent and others added 3 commits August 10, 2026 21:24
Drop provider colorHex when a Compass slot color is applied or a prior
slot is cleared so settle/refetch cannot resurrect the old hex fill.
Clear Google eventLabelId when writing a slot colorId. Defer draft
discard on drag/resize/nudge replace until onOptimisticApplied.

Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
Co-authored-by: Tyler Dane <tyler-dane@users.noreply.github.com>
…ked replace

Google only accepts eventLabelId clears under eventLabelVersion=1, which
ignores colorId — clear the label first, then write the slot colorId.
Return whether replace started and tear down covering drafts when it
does not, so blocked or no-op updates cannot leave a stuck draft.

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 21:53
@cursor
cursor Bot merged commit 7eb848d into main Aug 10, 2026
20 checks passed
@cursor
cursor Bot deleted the cursor/clear-event-color-optimistic-risks-8aa4 branch August 10, 2026 21:53
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