-
Notifications
You must be signed in to change notification settings - Fork 135
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 plugin pipeline race condition #1121
Conversation
🦋 Changeset detectedLatest commit: 0ae8a07 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
8d5c27e
to
0ae8a07
Compare
} | ||
} catch (err) { | ||
console.error('Failed to create PluginFactory', remotePlugin) | ||
throw err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I did here was wrap the entire thing in a try/catch (for debugging)
Fixes a race condition in our plugin pipeline:
#1120
There is currently inconsistencies between whether or not plugins are loaded in the Plugins[] array, or whether or not they are registered using .register. If they are loaded using .register, we don't wait wait for .load to finish resolving before invoking methods in that plugin. This is specifically an issue around plugins that are manually registered before analytics is initialized (i.e., most uses of analytics.register). The bug doesn't affect plugins loaded via action destinations, only plugins that are manually registered using analytics.register.
Bug repro:
Currently, this results in "page()!" being logged before ".load()!".