Repository navigation
[x-internals] Restore removed exports and pin internal dependencies - #23907
Conversation
`@mui/x-internals` 9.15.0 removed entry points and exports that published `@mui/x-*` 9.0.0 to 9.14.0 import through a `^9` range. A fresh install of those versions fails with `ERR_PACKAGE_PATH_NOT_EXPORTED`. - Restore the `store`, `fastArrayCompare`, `fastObjectShallowCompare`, `platform`, `reactMajor`, and `useFirstRender` entry points from v9.14.0. - Restore `getTarget` in `domUtils`, and `isFirefox` and `isJSDOM` in `platform`. - Accept a `nonce` string as the third argument of `loadStyleSheets` again. - Add a test that fails when one of these exports goes away. Fixes mui#23905 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Published packages declared `@mui/x-internals` and the other internal packages with a `^` range, so a removal in an internal package broke older published versions. - Use `workspace:*` instead of `workspace:^` for `@mui/x-internals`, `@mui/x-internal-gestures`, `@mui/x-charts-vendor`, and `@mui/x-virtualizer`. - Keep `^` for `@mui/x-license`, `@mui/x-telemetry`, and the public packages, which must stay shared. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e-23905-0fe888 # Conflicts: # pnpm-lock.yaml
Deploy previewBundle size
PerformanceTotal duration: 1,414.07 ms -159.67 ms(-10.1%) | Renders: 63 (+0) | Paint: 1,937.22 ms -284.55 ms(-12.8%)
21 tests within noise — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
🔵 Needs a closer look
Published-package resolution and mixed-version compatibility warrant human confirmation despite no identified blocking defects.
0 open findings
What changed in this PR
Restores compatibility for published MUI X 9.x packages affected by removed internal exports, addressing #23905.
Changes:
- Restore legacy entry points and exports, with removal deferred until v10.
- Restore string nonce support in
loadStyleSheetsand add regression tests. - Pin selected internal dependencies to exact versions for future releases.
| File | Description |
|---|---|
| pnpm-lock.yaml | Synchronizes dependency pins and restored store dependencies. |
| packages/x-virtualizer/package.json | Pins x-internals. |
| packages/x-tree-view/package.json | Pins x-internals. |
| packages/x-tree-view-pro/package.json | Pins x-internals. |
| packages/x-scheduler/package.json | Pins x-internals. |
| packages/x-scheduler-premium/package.json | Pins x-internals and x-virtualizer. |
| packages/x-scheduler-internals/package.json | Pins x-internals. |
| packages/x-scheduler-internals-premium/package.json | Pins x-internals. |
| packages/x-license/package.json | Pins x-internals; preserves telemetry range. |
| packages/x-internals/src/useFirstRender/useFirstRender.ts | Restores first-render hook. |
| packages/x-internals/src/useFirstRender/index.ts | Restores deprecated hook entry point. |
| packages/x-internals/src/tests/legacyExports.test.ts | Checks legacy exports and environment detection. |
| packages/x-internals/src/store/useStoreEffect.ts | Restores store effect subscriptions. |
| packages/x-internals/src/store/useStore.ts | Restores React store integration. |
| packages/x-internals/src/store/Store.ts | Restores legacy store implementation. |
| packages/x-internals/src/store/index.ts | Restores deprecated store entry point. |
| packages/x-internals/src/store/createSelectorType.ts | Restores selector types. |
| packages/x-internals/src/store/createSelector.ts | Restores selector utilities and memoization. |
| packages/x-internals/src/reactMajor/index.ts | Restores React version export. |
| packages/x-internals/src/platform/index.ts | Restores platform detection exports. |
| packages/x-internals/src/fastObjectShallowCompare/index.ts | Restores object comparison entry point. |
| packages/x-internals/src/fastObjectShallowCompare/fastObjectShallowCompare.ts | Restores shallow object comparison. |
| packages/x-internals/src/fastArrayCompare/index.ts | Restores array comparison entry point. |
| packages/x-internals/src/fastArrayCompare/fastArrayCompare.ts | Restores array comparison utility. |
| packages/x-internals/src/fastArrayCompare/fastArrayCompare.test.ts | Restores array comparison tests. |
| packages/x-internals/src/export/loadStyleSheets.tsx | Accepts legacy string nonce arguments. |
| packages/x-internals/src/export/loadStyleSheets.test.ts | Tests legacy nonce propagation. |
| packages/x-internals/src/domUtils/index.ts | Re-exports deprecated getTarget utility. |
| packages/x-internals/src/domUtils/getTarget.ts | Restores shadow-DOM-aware event targeting. |
| packages/x-internals/package.json | Adds external-store shim and types. |
| packages/x-date-pickers/package.json | Pins x-internals. |
| packages/x-date-pickers-pro/package.json | Pins x-internals. |
| packages/x-data-grid/package.json | Pins x-internals. |
| packages/x-data-grid-pro/package.json | Pins x-internals. |
| packages/x-data-grid-premium/package.json | Pins x-internals. |
| packages/x-data-grid-generator/package.json | Pins x-internals. |
| packages/x-charts/package.json | Pins internals, gestures, and vendor dependencies. |
| packages/x-charts-pro/package.json | Pins internals, gestures, and vendor dependencies. |
| packages/x-charts-premium/package.json | Pins internals and vendor dependencies. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
If you think that we shouldn't pin dependency in v9, I can drop this change and do it only on next major. |
michelengelen
left a comment
There was a problem hiding this comment.
LGTM ... Good to have the comments. The only suggestion would be to add the TODO v10: prefix on them so we can easily search for them.
Also shouldn't this target the v9 branch only?
|
This one's on me, I assumed that But can we instead re-export those utils from |
The removed code moved to `@base-ui/utils`, so the legacy entry points re-export it instead of a copy of the 9.14.0 code. - Re-export `store`, `fastObjectShallowCompare`, `useFirstRender`, `platform`, and `getTarget` from `@base-ui/utils`. - Keep `fastArrayCompare` as a wrapper of `areArraysEqual` with the old behavior, and keep `reactMajor` local. - Remove the `use-sync-external-store` dependency again. - Start each note with `TODO v10:`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oint `@base-ui/utils` 0.5.0 rejects a memoized selector whose combiner has fewer parameters than input selectors. `@mui/x-charts` 9.4.0 uses this pattern, so the re-export broke that version. - Restore the 9.14.0 store code and the `use-sync-external-store` dependency. - Add a test for the 9.4.0 selector pattern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This reverts commit 23b5bf9. Only `@mui/x-charts` 9.4.0 needs the store copy, and it can upgrade to 9.5.0 or later instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@michelengelen Thanks. All notes now start with About the v9 branch: @romgrk Done. The legacy entry points now re-export One version still fails: |
If we need to decrease the amount of selectors we could simply create a new memoized selector for both const selectorDefaultXYAxisIds = createSelectorMemoized(
selectorChartDefaultXAxisId,
selectorChartDefaultYAxisId,
(x, y) => { return {x,y} }
)- selectorChartDefaultXAxisId,
- selectorChartDefaultYAxisId,
+ selectorDefaultXYAxisIds,should have small impact |
`@base-ui/utils` throws "Unsupported number of arguments" when a memoized combiner has fewer parameters than input selectors. The old version accepted this, and `@mui/x-charts` 9.4.0 uses it. - Give such a combiner the full length in the legacy `createSelectorMemoized`. - Add a test for the 9.4.0 selector pattern. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude reply@JCQuintas Thanks, but that change cannot reach the code that fails. The failing selector is in the published 9.4.0 package, and on Instead, the legacy |
|
Got it, we should probably merge this before release |
Fixes #23905
@mui/x-internals9.15.0 removed entry points and exports that published@mui/x-*9.0.0 to 9.14.0 still import. Those packages declare@mui/x-internalswith a^9range, so a fresh install picks 9.15.0 and fails withERR_PACKAGE_PATH_NOT_EXPORTED. An upgrade of one package to 9.15.0 next to older ones has the same effect.Changes
@base-ui/utils, where the code moved:store,fastObjectShallowCompare,useFirstRender(useOnFirstRender),platform(isFirefox,isJSDOM,iOSMediaQuery), andgetTargetindomUtils.createSelectorMemoizedgives a combiner with fewer parameters than input selectors the full length before it calls Base UI. Base UI throwsUnsupported number of argumentsfor such a combiner, and@mui/x-charts9.4.0 has one:selectorChartSeriesFlatbushMappasses 7 input selectors to a combiner with 6 parameters.fastArrayComparewrapsareArraysEqualto keep its old===comparison and itsfalseresult for non-array values.reactMajorstays a local one-liner, because Base UI has no equivalent.loadStyleSheetsaccepts anoncestring as the third argument again. [charts-pro][data grid] Fix exports failing or hanging under a Content Security Policy #23521 changed it to an options object, so@mui/x-charts-pro9.14.0 and earlier lost the CSP nonce in export and print.TODO v10: removenote.legacyExports.test.tsfails when one of them goes away, and when the 9.4.0 selector pattern throws.@mui/x-internals,@mui/x-internal-gestures,@mui/x-charts-vendor, and@mui/x-virtualizerwithworkspace:*, so future releases depend on exact versions.@mui/x-license,@mui/x-telemetry, and the public packages keep^.Verification
@mui/x-internalsunder published packages:@mui/x-date-pickers-pro9.2.0 fails ongetTarget.LineChartandRichTreeViewrender on the server, andDataGridmounts in jsdom. Data grid 9.0.0 in Firefox gets its scrollertabIndexback.pnpm packof@mui/x-licensegives"@mui/x-internals": "9.15.0"and"@mui/x-telemetry": "^9.15.0".Notes
@base-ui/utilsrange of the newest@mui/x-internals. A breaking change in a later Base UI 0.x minor reaches 9.0.0 to 9.14.0 through them.@mui/x-charts-vendor, that is a second copy of d3.@mui/x-internalsisToolbarContext, and only communityx-chartsandx-data-gridimport it. However, charts-pro also imports and instantiates runtime classes from@mui/x-internal-gesturesinuseRegisterZoomGestures, then passes those instances to the community chart's gesture manager. Gesture instances therefore cross package boundaries, and mixed-version installations can involve different copies of the gestures package.^9, so the legacy exports must stay until v10.Generated with Claude Code