fix: prevent duplicate events when rescheduling events with attached sessions #3255
+70
−4
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
Fixes an issue where rescheduling a calendar event that has an attached note/session would cause duplicate entries to appear in the left sidebar - one with the old time and one with the new time.
The root cause was in the calendar sync logic: events with non-empty sessions were skipping the rescheduled event detection entirely. This meant:
The fix moves the
hasNonEmptySessioncheck to after the rescheduled event detection, so events with sessions are also updated when rescheduled.Review & Testing Checklist for Human
findRescheduledEventfunction won't match it (relies on title matching). This is existing behavior but worth noting.Notes
findRescheduledEventfunction matches events by: same title, same calendar, different tracking ID, and within 30 days of the original time.Link to Devin run: https://app.devin.ai/sessions/b9f505cc5b5b4f848c65ae00aec87989
Requested by: @ComputelessComputer