[scheduler] preserve multi-day event continuity across overflow#22797
[scheduler] preserve multi-day event continuity across overflow#22797mustafajw07 wants to merge 7 commits into
Conversation
Deploy previewhttps://deploy-preview-22797--material-ui-x.netlify.app/ Bundle size
Check out the code infra dashboard for more information about this PR. |
|
Hey @rita-codes , Can i get a review on this? |
There was a problem hiding this comment.
Pull request overview
This PR adjusts the Scheduler day-grid positioning logic to preserve multi-day event continuity when rows “compact” (e.g., when earlier events end and lower row indexes become available), which is a key piece of fixing Month view overflow behavior where a continuation bar could disappear mid-span.
Changes:
- Reworked
useEventOccurrencesWithDayGridPositionto allow multi-day events to “re-segment” into a lower available row by shortening the previous segment and starting a new segment. - Updated internal positioning tests to reflect the new segmented behavior (and added/adjusted assertions).
- Updated WeekView all-day column-span expectation to reflect the new segmented span behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/x-scheduler/src/week-view/tests/WeekView.test.tsx | Updates all-day span expectation; needs comment alignment with new segmented behavior. |
| packages/x-scheduler-internals/src/use-event-occurrences-with-day-grid-position/useEventOccurrencesWithDayGridPosition.ts | Core change: track active segments and split/compact multi-day bars when lower rows open up. |
| packages/x-scheduler-internals/src/use-event-occurrences-with-day-grid-position/useEventOccurrencesWithDayGridPosition.test.ts | Test expectations updated; some descriptions/comments need to be brought in sync with new behavior. |
| packages/x-scheduler-internals/src/calendar-grid/use-placeholder-in-day/useCalendarGridPlaceholderInDay.ts | Placeholder index selection updated to avoid always using row 1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Should span 4 columns (4 days) | ||
| expect(gridColumnSpan).to.equal('4'); | ||
| expect(gridColumnSpan).to.equal('3'); |
|
|
||
| expect(result.maxIndex).to.equal(2); | ||
| expect(result.days[1].withPosition[1].id).to.equal('B'); | ||
| expect(result.days[1].withPosition[1].position).to.deep.equal({ index: 2, daySpan: 2 }); | ||
| expect(result.days[1].withPosition[1].position).to.deep.equal({ index: 2, daySpan: 1 }); | ||
| expect(result.days[2].withPosition[0].id).to.equal('B'); |
| // Event A is not present on day 3, so event C should use index 1 on that day instead of using index 3 below Event B | ||
| expect(result.maxIndex).to.equal(2); | ||
| expect(result.days[2].withPosition[0].id).to.equal('C'); | ||
| expect(result.days[2].withPosition[0].id).to.equal('B'); | ||
| expect(result.days[2].withPosition[0].position).to.deep.equal({ index: 1, daySpan: 1 }); | ||
| }); |
|
Thanks for tackling this, @mustafajw07! I caught a regression in the Argos diff we should sort out before this goes in. In the week view, The compaction in
This ties into the two changes we agreed on in yesterday's sync:
Also please make sure drag & drop stays accurate with whatever new ordering/index logic you land on. What do you think? If you have any doubts or would prefer we take it over, just let me know 🙌
|
|
Thanks for the detailed review and for catching the regression. You're right — the current activeSegments compaction logic reassigns a lower index whenever one becomes available, without distinguishing between normal compaction and an event that was previously hidden by overflow. That explains the week-view regression where the bar gets split even though there is no "+N more" involved. I'll rework the logic so that multi-day events keep their original row and render continuously unless they were actually hidden in overflow. I'll also revisit the ordering to prioritize multi-day events, add the continuation-arrow behavior for resurfacing events (including in the "+N more" popover), and verify drag & drop behavior against the updated positioning logic. I'll push an update once I've worked through those changes. Thanks again for the clear explanation and screenshots! |
|
Hi @rita-codes , I've also revisited the positioning logic and updated the related tests accordingly. Could you please take another look when you have a chance? Thanks again for the detailed review and guidance. |


Closes #22735
Changelog