Skip to content

fix(runtime-core): dedupe concurrent Module.init() calls#4380

Merged
ScriptedAlchemy merged 5 commits intomainfrom
cursor/core-issue-4330-4bc1
Feb 8, 2026
Merged

fix(runtime-core): dedupe concurrent Module.init() calls#4380
ScriptedAlchemy merged 5 commits intomainfrom
cursor/core-issue-4330-4bc1

Conversation

@ScriptedAlchemy
Copy link
Copy Markdown
Member

Description

This PR addresses the issue of Module.init() being called multiple times concurrently, which could lead to redundant or problematic re-initialization of remote modules.

The changes introduce a mechanism to deduplicate concurrent Module.init() calls by utilizing a shared in-flight promise. This ensures that the remote module's initialization logic (including initContainer and beforeInitContainer hooks) is executed only once, even when init() is invoked simultaneously. Proper cleanup of initing and initPromise is also ensured after the initialization completes.

A new regression test has been added to verify this behavior, asserting that concurrent init() calls result in a single execution of the underlying initialization logic and leave the module in a stable, initialized state.

Related Issue

#4330

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

Open in Cursor Open in Web

Co-authored-by: Zack Jackson <ScriptedAlchemy@users.noreply.github.com>
@cursor
Copy link
Copy Markdown

cursor bot commented Feb 8, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Feb 8, 2026

🦋 Changeset detected

Latest commit: 0bfd992

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@module-federation/runtime-core Patch
@module-federation/runtime Patch
@module-federation/bridge-react Patch
@module-federation/devtools Patch
@module-federation/data-prefetch Patch
@module-federation/dts-plugin Patch
@module-federation/metro Patch
@module-federation/modern-js-v3 Patch
@module-federation/modern-js Patch
@module-federation/nextjs-mf Patch
@module-federation/node Patch
@module-federation/retry-plugin Patch
@module-federation/runtime-tools Patch
@module-federation/webpack-bundler-runtime Patch
@module-federation/bridge-vue3 Patch
@module-federation/enhanced Patch
@module-federation/metro-plugin-rnc-cli Patch
@module-federation/metro-plugin-rnef Patch
shared-tree-shaking-with-server-host Patch
shared-tree-shaking-with-server-provider Patch
@module-federation/rsbuild-plugin Patch
@module-federation/rspack Patch
@module-federation/inject-external-runtime-core-plugin Patch
@module-federation/rspress-plugin Patch
@module-federation/storybook-addon Patch
shared-tree-shaking-no-server-host Patch
shared-tree-shaking-no-server-provider Patch
remote5 Patch
remote6 Patch
website-new Patch
@module-federation/sdk Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin Patch
@module-federation/error-codes Patch
create-module-federation Patch
@module-federation/cli Patch
@module-federation/esbuild Patch
@module-federation/utilities Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 8, 2026

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 0bfd992
🔍 Latest deploy log https://app.netlify.com/projects/module-federation-docs/deploys/69881a6bbfa6a600085ef11f
😎 Deploy Preview https://deploy-preview-4380--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 8, 2026

Bundle Size Report

2 package(s) changed, 34 unchanged.

Package Total dist Delta ESM gzip Delta
runtime-core 305.0 kB +741 B (+0.2%) 25.5 kB +60 B (+0.2%)
vue3-bridge 158.9 kB +363 B (+0.2%) 23.2 kB +42 B (+0.2%)

Total dist: 4.95 MB (+1.1 kB (+0.0%))
Total ESM gzip: 154.7 kB (+102 B (+0.1%))

@ScriptedAlchemy ScriptedAlchemy changed the title Core issue 4330 cursor/core-issue-4330-4bc1 Feb 8, 2026
@ScriptedAlchemy ScriptedAlchemy changed the title cursor/core-issue-4330-4bc1 fix(runtime-core): dedupe concurrent Module.init() calls Feb 8, 2026
…0-4bc1

# Conflicts:
#	.github/workflows/actionlint.yml
@ScriptedAlchemy ScriptedAlchemy marked this pull request as ready for review February 8, 2026 05:00
@ScriptedAlchemy ScriptedAlchemy merged commit 5fa878e into main Feb 8, 2026
22 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the cursor/core-issue-4330-4bc1 branch February 8, 2026 05:23
@2heal1 2heal1 mentioned this pull request Feb 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants