Agents Manager: externalize react-dom/client to the host's ReactDOM#112428
Closed
iamchughmayank wants to merge 1 commit into
Closed
Agents Manager: externalize react-dom/client to the host's ReactDOM#112428iamchughmayank wants to merge 1 commit into
iamchughmayank wants to merge 1 commit into
Conversation
Jetpack Cloud Live (direct link)
Automattic for Agencies Live (direct link)
Dashboard Live (dotcom) (direct link)
|
iamchughmayank
marked this pull request as ready for review
July 8, 2026 14:58
iamchughmayank
requested review from
aagam-shah,
kat3samsin,
saroshaga and
t-wright
July 8, 2026 14:59
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Agents Manager widget webpack build to ensure react-dom/client is treated as a WordPress-provided external, preventing the widget from bundling its own react-dom (and avoiding React runtime/version mismatches with the block editor host).
Changes:
- Externalize
react-dom/clientto the host’sReactDOMglobal socreateRootuses WordPress’sreact-dom. - Map
react-dom/clientto thereact-domscript handle viarequestToHandleso the generated*.asset.jsondeclares the correct dependency.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
iamchughmayank
force-pushed
the
update/am-externalise-react-dom
branch
from
July 8, 2026 15:03
65f903e to
32201fb
Compare
- Map react-dom/client → ReactDOM external + the react-dom script handle - Stops bundling react-dom, which shipped its own React runtime and clashed with the editor host's React (calypso builds React 19, host is React 18) - Mirrors odyssey-stats / blaze-dashboard, which externalize the React runtime Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
iamchughmayank
force-pushed
the
update/am-externalise-react-dom
branch
from
July 8, 2026 15:04
32201fb to
3fc81a6
Compare
|
Looks like one of the E2E tests has failed. You can fix them following these steps:
|
Contributor
|
Seems duplicated: #112421 |
Contributor
Author
|
closing in favour of #112428 (comment) |
Contributor
|
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
react-dom/clientin the Agents Manager widget build socreateRootresolves to WordPress'sReactDOMinstead of bundling a copy ofreact-dom, and map the subpath to thereact-domscript handle so it is declared as a dependency.Why are these changes being made?
The Agents Manager widgets externalize
reactandreact-domto the React that WordPress provides, but the dependency-extraction plugin does not externalize thereact-dom/clientsubpath — socreateRootpulls a bundled copy ofreact-dominto the widget. A bundled react-dom ships its own React runtime, which is incompatible with the host's React whenever the versions differ.Now that calypso builds against React 19 (#112339), a widget rebuilt from trunk bundles react-dom 19 while the block-editor host still runs React 18, which crashes the sidebar at mount (
Cannot read properties of undefined (reading 'S')/ minified React error 525). Externalizingreact-dom/clientmakes the widget use the host's react-dom, so it always matches the host — React 18 today and React 19 automatically once the host migrates.Same rationale as
odyssey-statsandblaze-dashboard, which externalize the React runtime to the host; this change additionally maps thereact-dom/clientsubpath.Testing Instructions
widgets.wp.comand runcd apps/agents-manager && yarn dev --sync.Pre-merge Checklist