Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime): catch init remote error in errorLoadRemote hook #3019

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

2heal1
Copy link
Member

@2heal1 2heal1 commented Sep 30, 2024

Description

catch init remote error in errorLoadRemote hook

Related Issue

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.

Copy link

changeset-bot bot commented Sep 30, 2024

🦋 Changeset detected

Latest commit: 7f790e4

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

This PR includes changesets to release 38 packages
Name Type
@module-federation/runtime Patch
@module-federation/devtools Patch
@module-federation/data-prefetch Patch
@module-federation/dts-plugin 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/enhanced Patch
@module-federation/modern-js Patch
@module-federation/rspack Patch
3008-runtime-remote Patch
host Patch
host-v5 Patch
host-vue3 Patch
remote1 Patch
remote2 Patch
remote3 Patch
remote4 Patch
@module-federation/modernjs Patch
modernjs-ssr-dynamic-nested-remote Patch
modernjs-ssr-dynamic-remote-new-version Patch
modernjs-ssr-dynamic-remote Patch
modernjs-ssr-host Patch
modernjs-ssr-nested-remote Patch
modernjs-ssr-remote-new-version Patch
modernjs-ssr-remote Patch
@module-federation/sdk Patch
@module-federation/managers Patch
@module-federation/manifest Patch
@module-federation/third-party-dts-extractor Patch
@module-federation/bridge-react Patch
@module-federation/bridge-vue3 Patch
@module-federation/bridge-shared Patch
@module-federation/bridge-react-webpack-plugin 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

Copy link

netlify bot commented Sep 30, 2024

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 7f790e4
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/66fa46e37b9a8c0008ec0b13
😎 Deploy Preview https://deploy-preview-3019--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 site configuration.

Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This pull request introduces changes to the runtime module of the application to improve error handling when loading remote modules. The key changes are:

  • Added a new 'beforeLoadShare' lifecycle event to the RemoteHandler class to catch and handle errors that may occur during the initialization of a remote module.
  • Wrapped the call to module.getEntry() in the SharedHandler class with a try-catch block to catch any errors and emit an errorLoadRemote event in case of an error.

These changes aim to enhance the robustness and reliability of the remote module loading process by providing more comprehensive error handling and reporting. The updates ensure that the application can gracefully handle and recover from errors that may occur during the initialization of remote modules, improving the overall user experience.

File Summaries
File Summary
packages/runtime/src/remote/index.ts The code changes introduce a new error handling case in the errorLoadRemote hook of the RemoteHandler class. Specifically, it adds a new 'beforeLoadShare' lifecycle event to handle errors that may occur during the initialization of a remote module.
packages/runtime/src/shared/index.ts The code changes introduce a try-catch block around the call to module.getEntry() in the SharedHandler class. This is done to catch any errors that may occur during the initialization of a remote module, and to emit a errorLoadRemote event in the event of an error. The purpose of this change is to improve the error handling and robustness of the remote module loading process.

Copy link
Contributor

@squadronai squadronai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incremental Review

Comments posted: 1

Configuration

Squadron Mode: essential

Commits Reviewed

15f9de1ae9a11a06ed1af8556b14b83ce57fb3a4...7f790e42e3300eae6df481e03a6f5dd1fb0f47ff

Files Reviewed
  • packages/runtime/src/remote/index.ts
  • packages/runtime/src/shared/index.ts
Files Ignored

These files were ignored due to the filter in the squadron.yaml file.

  • .changeset/nervous-tomatoes-raise.md

@module-federation module-federation deleted a comment from squadronai bot Sep 30, 2024
@ScriptedAlchemy ScriptedAlchemy merged commit fac6ecf into main Sep 30, 2024
19 of 20 checks passed
@ScriptedAlchemy ScriptedAlchemy deleted the fix/error-load-remote branch September 30, 2024 18:46
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.

2 participants