Skip to content

[codex] Fix Day recurrence update loop#1845

Merged
Uarmagan merged 2 commits into
mainfrom
fix/day-recurrence-update-loop
Jun 1, 2026
Merged

[codex] Fix Day recurrence update loop#1845
Uarmagan merged 2 commits into
mainfrom
fix/day-recurrence-update-loop

Conversation

@Uarmagan
Copy link
Copy Markdown
Contributor

@Uarmagan Uarmagan commented Jun 1, 2026

Summary

  • Prevent the recurring-event editor from writing the same recurrence rule back into the event when nothing changed.
  • Keep the Week recurring draft confirmation path aware of the base recurrence rule for recurring instances.
  • Add regression coverage for the Day update loop and the Week recurring draft behavior.
  • Stabilize the planner sidebar month-label unit test by freezing its test clock.

Root Cause

The Day editor writes form changes back into the active draft immediately. When Repeat was enabled, the recurrence hook kept regenerating and writing an equivalent rule back into that draft. That refreshed the form path and triggered the same write again, which could end in React's maximum update depth crash.

The shared fix is to compare the generated recurrence rule with the event's current rule before updating. If the rule is unchanged, the editor does nothing.

The failing PR unit check was separate from the recurrence fix: the sidebar month-label test depended on the real current month. Once CI crossed into June, a May fixture correctly rendered as "May" instead of "This Month". The test now pins the clock to the intended May date.

Validation

  • Confirmed the new recurrence regression test fails when the guard is removed, then passes when restored.
  • bun test src/views/Forms/EventForm/DateControlsSection/RecurrenceSection/useRecurrence/useRecurrence.test.ts src/views/Forms/EventForm/DateControlsSection/RecurrenceSection/RecurrenceSection.test.tsx
  • bun test src/views/Week/components/Draft/hooks/state/useDraftConfirmation.test.tsx src/views/Week/components/Draft/grid/GridDraft.test.tsx
  • bun test src/components/PlannerSidebar/SomedayEventSections/SomedayEventSections.test.tsx
  • TZ=UTC bun test src/components/PlannerSidebar/SomedayEventSections/SomedayEventSections.test.tsx
  • bun test:web
  • Browser smoke: Day event editor opens Repeat without crashing.
  • Browser smoke: Week event editor opens Repeat without crashing.
  • bun lint
  • bun type-check
  • git diff --check

Notes

  • Consolidate Day and Week event editing behavior #1843 tracks the larger Day/Week event-editing consolidation question; this PR only fixes the visible recurrence crash, protects the nearby Week recurring flow, and stabilizes the unrelated date-sensitive unit test that was blocking this PR.

@Uarmagan Uarmagan marked this pull request as ready for review June 1, 2026 02:55
@Uarmagan Uarmagan merged commit d787868 into main Jun 1, 2026
9 checks passed
@Uarmagan Uarmagan deleted the fix/day-recurrence-update-loop branch June 1, 2026 02:55
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.

1 participant