[codex] Fix Day recurrence update loop#1845
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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
bun test src/views/Forms/EventForm/DateControlsSection/RecurrenceSection/useRecurrence/useRecurrence.test.ts src/views/Forms/EventForm/DateControlsSection/RecurrenceSection/RecurrenceSection.test.tsxbun test src/views/Week/components/Draft/hooks/state/useDraftConfirmation.test.tsx src/views/Week/components/Draft/grid/GridDraft.test.tsxbun test src/components/PlannerSidebar/SomedayEventSections/SomedayEventSections.test.tsxTZ=UTC bun test src/components/PlannerSidebar/SomedayEventSections/SomedayEventSections.test.tsxbun test:webbun lintbun type-checkgit diff --checkNotes