fix(runtime-core): prevent duplicate remote entry initialization#4371
fix(runtime-core): prevent duplicate remote entry initialization#4371
Conversation
Add initing flag to track initialization state and avoid concurrent init calls
🦋 Changeset detectedLatest commit: 72a17e4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
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 |
✅ Deploy Preview for module-federation-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1a8159fc5d
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (!this.inited && !this.initing) { | ||
| this.initing = true; |
There was a problem hiding this comment.
Reset initing when init fails to avoid permanent skip
If remoteEntryExports.init(...) or the hooks throw, initing remains true and inited stays false, so subsequent init() calls will skip initialization forever and still return remoteEntryExports, leaving the remote uninitialized. This only happens after a transient failure (network error, bad remote entry, hook exception), but in that case it permanently blocks recovery in the same process. Consider resetting initing in a finally/catch so a later retry can re-run initialization.
Useful? React with 👍 / 👎.
Description
Add initing flag to track initialization state and avoid concurrent init calls
Related Issue
Types of changes
Checklist