Skip to content

[scheduler] Support array values for CalendarEvent.resource#23109

Merged
rita-codes merged 7 commits into
mui:masterfrom
mustafajw07:feature/23014-multi-resource-arrays
Jul 16, 2026
Merged

[scheduler] Support array values for CalendarEvent.resource#23109
rita-codes merged 7 commits into
mui:masterfrom
mustafajw07:feature/23014-multi-resource-arrays

Conversation

@mustafajw07

@mustafajw07 mustafajw07 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Closes #23014

Changelog

@mustafajw07

Copy link
Copy Markdown
Contributor Author

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

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy preview

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-scheduler 🔺+8B(0.00%) 🔺+3B(0.00%)
@mui/x-scheduler-premium 🔺+8B(0.00%) 🔺+2B(0.00%)
@mui/x-chat 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.

@mustafajw07

Copy link
Copy Markdown
Contributor Author

Hi @rita-codes , just following up on this PR. When you have a chance, could you please take another look?

@zannager zannager added the scope: scheduler Changes related to the scheduler. label Jul 14, 2026
@rita-codes rita-codes added the type: new feature Expand the scope of the product to solve a new problem. label Jul 15, 2026

@rita-codes rita-codes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR! The scope is right — the runtime array handling already landed on master with #23013, so limiting this PR to the type widening, the two remaining raw resource reads in useDropTarget, propTypes, demo hardening, and tests is exactly what #23014 asks for. A few things worth a look before merging.

🟡 Timeline aria-labelledby breaks for multi-resource events

This one lives in a file the diff doesn't touch: the Timeline builds each event's aria-labelledby from the raw resource value (EventTimelinePremiumContent.tsx, `...TitleCell-${occurrence.resource}`, same pattern for the placeholder). The title cell ids are built from a single resource id, so with an array this interpolates to ...TitleCell-r1,r2, which matches no element — multi-resource events lose their accessible name in exactly the one-row-per-resource rendering this PR enables. Note the instance rendered in each row should probably be labelled by that row's title cell rather than by the occurrence's own resource. If we prefer, this can also move to #23017 with the rest of the multi-row correctness work — but let's not lose it.

🟡 The event-level "visible if ≥1 resource visible" semantics is only tested through a selector that masks it

groupedByResourceList already skips hidden resources as rows, so the "all assigned resources hidden → empty response" test passes even if the event-level visibility filter in getOccurrencesFromEvents were removed. The null-resource test is weaker still: the response is empty either way, so the not.to.include assertion passes vacuously (as its own comment hints). The semantics that matters for the EventCalendar — the event renders (once) as long as at least one assigned resource is visible — is decided in getOccurrencesFromEvents, so it would be better pinned by testing it directly; event-utils.test.ts already covers the two helpers and is a natural home.

🟡 Unnecessary cast in the test builder

In EventBuilder.resources(), the (this.event as { resource?: unknown }) cast shouldn't be needed — SchedulerEvent['resource'] is widened in this same PR, so the direct assignment typechecks. The JSDoc also mentions the processed-event field, but this sets the raw event one.

🟡 JSDoc on the widened fields still describes a single id

In models/event.ts, both the SchedulerEvent field and the processed-event variant still read "The id of the resource this event is associated with." after the type change. The docs pages are deliberately left untouched (we're not announcing multi-resource yet), but the type's own JSDoc should match its signature.

ℹ️ The modified fallback branches in useDropTarget are unreachable

Heads-up, nothing to fix here: the resourceId = null default in the destructuring means resourceId === undefined can never be true, so the two getPrimaryResourceId fallbacks are dead code (pre-existing structure). The change is still the right minimal edit to keep the file compiling against the widened type — just noting the new code path can't be exercised by tests.

ℹ️ Known array-collapsing paths remain until #23016/#23017

Dragging a multi-resource event in the Timeline (even a pure time move within its own row) writes a single row id back to resource, and saving the dialog collapses to the primary id. Both are explicitly deferred in the umbrella plan (#23017 non-destructive DnD, #23016 dialog editing) and the feature is dormant/unannounced, so this ships as-is per the plan — just confirming it's intentional.

Also: the test_e2e failure looks unrelated — it died at the "Build packages" step while test_e2e_react_18 and every other job passed; a re-run should clear it.


🤖 Review generated with Claude Code

@mustafajw07

mustafajw07 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

@rita-codes

Thanks for the thorough review! I've addressed the requested changes:

  • Added direct tests for the event visibility semantics in getOccurrencesFromEvents().

  • Removed the unnecessary cast in EventBuilder.resources() and updated the related JSDoc.

  • Updated the JSDoc on the widened resource fields to reflect the new type.

  • I haven't included the Timeline aria-labelledby fix in this PR. Since that falls under the remaining Timeline multi-resource correctness work, I think it makes sense to address it as part of [scheduler] EventTimeline: multi-row occurrence correctness #23017 alongside the other Timeline changes.

@mustafajw07
mustafajw07 requested a review from rita-codes July 15, 2026 10:37
@rita-codes

rita-codes commented Jul 15, 2026

Copy link
Copy Markdown
Member

Thanks, the new getOccurrencesFromEvents tests pin exactly the semantics that were missing (including the render-once behavior), and the cleanups look good. Agreed on deferring the aria-labelledby fix — I've added a note to #23017 so it doesn't get lost.

Thanks for taking care of this! 👏

@mustafajw07

Copy link
Copy Markdown
Contributor Author

Thank you for the review and for the approval! I really appreciate your time and feedback. 🙌

@rita-codes
rita-codes merged commit 411894c into mui:master Jul 16, 2026
22 checks passed
@mustafajw07
mustafajw07 deleted the feature/23014-multi-resource-arrays branch July 16, 2026 08:37
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: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scheduler] Widen CalendarEvent["resource"] to support arrays

3 participants