Skip to content

[scheduler] preserve multi-day event continuity across overflow#22797

Open
mustafajw07 wants to merge 7 commits into
mui:masterfrom
mustafajw07:fix/22735-scheduler-month-view-continuation-overflow
Open

[scheduler] preserve multi-day event continuity across overflow#22797
mustafajw07 wants to merge 7 commits into
mui:masterfrom
mustafajw07:fix/22735-scheduler-month-view-continuation-overflow

Conversation

@mustafajw07

@mustafajw07 mustafajw07 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Closes #22735

Changelog

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 12, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-22797--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@zannager zannager added the scope: scheduler Changes related to the scheduler. label Jun 12, 2026
@mustafajw07

Copy link
Copy Markdown
Contributor Author

Hey @rita-codes , Can i get a review on this?

@rita-codes rita-codes added the type: bug It doesn't behave as expected. label Jun 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 useEventOccurrencesWithDayGridPosition to 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.

Comment on lines +175 to +176
// Should span 4 columns (4 days)
expect(gridColumnSpan).to.equal('4');
expect(gridColumnSpan).to.equal('3');
Comment on lines 60 to 64

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');
Comment on lines 78 to 82
// 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 });
});
@rita-codes

rita-codes commented Jun 17, 2026

Copy link
Copy Markdown
Member

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, Event 5 gets split into two disjoint pieces — a chip on Tue (bottom row) and a separate full-width bar starting Wed (top row) — even though there's no "+N more" overflow in any of those cells. On master the same event stays in a single row and renders as one continuous bar. So we're splitting events unconditionally whenever a lower row frees up, not only when there's actual overflow.

The compaction in useEventOccurrencesWithDayGridPosition.ts (activeSegments) reopens the bar at the smallest available index as soon as a row frees up, without checking whether the event was actually hidden. I think the rule should be:

  • No "+N more" in the next cell → keep the event in its original row, rendered continuously (same index), like master does today.
  • Split + continuation arrow only when the event was hidden inside the "+N more" section on its starting day(s) and resurfaces on a later day where it now fits.

This ties into the two changes we agreed on in yesterday's sync:

  1. Render multi-day events first (breaking strict start-date ordering) so long events get the top rows and land in the "+N more" overflow less often.
  2. When an event is hidden in "+N more" on its starting day(s), render it on later days with an arrow indicating it continues from a previous (hidden) day — including showing that arrow inside the "+N more" popover, which we don't do today.

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 🙌

Screenshot 2026-06-16 at 18 01 52 Screenshot 2026-06-16 at 17 56 34

@mustafajw07

Copy link
Copy Markdown
Contributor Author

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!

@mustafajw07

Copy link
Copy Markdown
Contributor Author

Hi @rita-codes ,
I've pushed an update addressing the feedback around the multi-day event regression. The latest changes preserve row continuity for multi-day events and avoid splitting events when there is no actual overflow.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: scheduler Changes related to the scheduler. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scheduler] Month view: multi-day event's continuation bar breaks when bumped into "+N more"

4 participants