Remove MessageChannel shim #2247 - #2248
Open
rymsha wants to merge 1 commit into
Open
Conversation
Since @enonic/react4xp 7.0.0 resolves React packages with the edge-light condition (enonic/npm-react4xp#1627), SSR bundles load react-dom/server.edge, which does not construct a MessageChannel at module load. The shim only existed to let server.browser bundles load, so it can go, along with the server.browser test bundle and the test that pinned the shim's contract. Apps must build with @enonic/react4xp >= 7.0.0; older bundles resolving react-dom/server.browser will now fail to load at SSR engine warmup. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FxjAJqqTs6SpY2ze8nZJYm
anatol-sialitski
approved these changes
Jul 29, 2026
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.
Closes #2247
Since enonic/npm-react4xp#1627 (@enonic/react4xp 7.0.0), SSR bundles resolve React with the
edge-lightcondition and loadreact-dom/server.edge, which does not construct aMessageChannelat module load. The transitional shim innodePolyfills.tsis therefore no longer needed.Beyond being unnecessary, the shim clashed with how the edge build (and React's
schedulerpackage) is designed to behave: they feature-detect globals likeMessageChanneland pick fallbacks when absent. The shim's no-op ports made that detection succeed while message delivery silently never happened — code taking the MessageChannel path would hang instead of using its own fallback or failing loudly. With the shim gone, feature detection works as intended.Changes
nodePolyfills.ts— remove theMessagePortShimfunction and theMessageChannelinstall block. Timers,TextEncoder, andatob/btoapolyfills are unchanged (still required —server.edgelooks upTextEncoderat module load).RendererTest.java— remove the test that pinned the shim's contract (render_real_react_component_via_server_browser_with_message_channel_shim). Theserver.edgetest with a real React 19 bundle remains and covers the production path.src/test/js/react-bundle-server-browser-entry.js, thebuild:react-server-browser-test-bundlenpm script, and thebundleReactServerBrowserForTestGradle task.Compatibility
Apps must build with @enonic/react4xp >= 7.0.0. Assets compiled with 6.x (bundling
react-dom/server.browser) will now fail at SSR engine warmup withMessageChannel is not defined. The upgrade notes in doc-react4xp state this (enonic/doc-react4xp#1).Verification
tsc --noEmit -p tsconfig.graal.jsonpasses./gradlew test --tests "...RendererTest"green, including the realreact-dom/server.edgerender in a GraalJS context🤖 Generated with Claude Code
https://claude.ai/code/session_01FxjAJqqTs6SpY2ze8nZJYm