Skip to content

[scheduler] Use @base-ui generateId for event ids in createEventModel#22788

Merged
rita-codes merged 5 commits into
mui:masterfrom
rita-codes:22760-scheduler-createeventmodel-uses-cryptorandomuuid-directly-breaks-on-non-secure-contexts
Jun 12, 2026
Merged

[scheduler] Use @base-ui generateId for event ids in createEventModel#22788
rita-codes merged 5 commits into
mui:masterfrom
rita-codes:22760-scheduler-createeventmodel-uses-cryptorandomuuid-directly-breaks-on-non-secure-contexts

Conversation

@rita-codes

@rita-codes rita-codes commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

createEventModel generated event ids with a bare crypto.randomUUID() call. crypto.randomUUID only exists in a secure context (HTTPS or localhost) and in recent browsers, so on plain-HTTP deployments (intranet, IP-based staging) or older browsers it throws crypto.randomUUID is not a function, breaking event creation and drag-from-outside in production.

This switches createEventModel to @base-ui/utils/generateId, which generates ids without touching crypto at all (it uses a counter + Math.random()), so the secure-context issue is gone by construction and there is no extra helper to maintain.

Changes

  • Use generateId('event') in createEventModel instead of calling crypto.randomUUID() directly.

Closes #22760

@rita-codes rita-codes self-assigned this Jun 11, 2026
@rita-codes rita-codes added type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. scope: scheduler Changes related to the scheduler. scope: chat Changes related to the AI chat. labels Jun 11, 2026
…torandomuuid-directly-breaks-on-non-secure-contexts
@rita-codes
rita-codes requested a review from noraleonte June 11, 2026 19:24
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-22788--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.

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.

We could use @base-ui/utils/generateId and get rid of this file (here and in the chat package).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh yes! Thanks for the heads up!! cc @hasdfa

Address review: replace the createLocalId helper with the existing
@base-ui/utils/generateId, which avoids crypto.randomUUID entirely.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@rita-codes rita-codes removed the scope: chat Changes related to the AI chat. label Jun 12, 2026
@rita-codes rita-codes changed the title [scheduler] Guard crypto.randomUUID() in createEventModel [scheduler] Use @base-ui generateId for event ids in createEventModel Jun 12, 2026
@rita-codes
rita-codes requested a review from romgrk June 12, 2026 07:10

@noraleonte noraleonte 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.

🙏 💪

…torandomuuid-directly-breaks-on-non-secure-contexts
…torandomuuid-directly-breaks-on-non-secure-contexts
@rita-codes
rita-codes merged commit 4968977 into mui:master Jun 12, 2026
21 checks passed
mbrookes pushed a commit to mbrookes/mui-x that referenced this pull request Jun 27, 2026
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: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[scheduler] createEventModel uses crypto.randomUUID() directly — breaks on non-secure contexts

3 participants