Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

fix: client side load module race condition #173

Merged
merged 8 commits into from
Mar 13, 2024
Merged

Conversation

giulianok
Copy link
Member

@giulianok giulianok commented Feb 20, 2024

Description

When externals fallbacks are being loaded, a module load could be triggered which could also load external fallbacks that shouldn't be loaded since they are being currently loaded. This change makes sure that external fallbacks are loaded before starting loading any additional module(s).

Motivation and Context

Avoid race condition that could load duplicate external fallbacks

How Has This Been Tested?

Manual testing and unit test

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation (adding or updating documentation)
  • Dependency update

Checklist:

  • My change requires a change to the documentation and I have updated the documentation accordingly.
  • My changes are in sync with the code style of this project.
  • There aren't any other open Pull Requests for the same issue/update.
  • These changes should be applied to a maintenance branch.
  • This change requires cross browser checks.
  • This change impacts caching for client browsers.
  • This change adds additional environment variable requirements for Holocron users.
  • I have added the Apache 2.0 license header to any new files created.

What is the Impact to Developers Using Holocron?

@giulianok giulianok marked this pull request as ready for review March 10, 2024 23:10
@giulianok giulianok requested review from a team as code owners March 10, 2024 23:10
integrity: browserIntegrity,
})));
await Promise.all(fallbacks.map(async ({ name, browserIntegrity }) => {
if (loadingFallbacks.has(browserIntegrity)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Some thoughts on using browserIntegrity:
could updates to the bundler alter the build output resulting in the same package ending with different integrity values? If this is the case would name-version be a more reliable key ?

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah could happen, and i think name-version or something similar would make it easier to debug and less prune to mismatches

JAdshead
JAdshead previously approved these changes Mar 12, 2024
bishnubista
bishnubista previously approved these changes Mar 12, 2024
Co-authored-by: Jamie King <[email protected]>
@giulianok giulianok dismissed stale reviews from bishnubista and JAdshead via 6efe297 March 13, 2024 01:23
@giulianok giulianok merged commit 3183bbb into main Mar 13, 2024
3 checks passed
@giulianok giulianok deleted the fix/race-condition branch March 13, 2024 16:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants