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

ref(baseclient): Simplify the setup logic of integrations #4952

Merged
merged 1 commit into from
Apr 20, 2022

Conversation

lforst
Copy link
Member

@lforst lforst commented Apr 19, 2022

Simplifies the logic of setupIntegrations a tiny bit.

This is a follow-up task of #4927

@lforst lforst changed the title Lforst setup integrations refactor ref(baseclient): Simplify the setup logic of integrations Apr 19, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Apr 19, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 20.22 KB (+0.8% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 64.37 KB (-0.28% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.85 KB (+0.41% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 58.03 KB (+0.13% 🔺)
@sentry/browser - Webpack (gzipped + minified) 23.4 KB (+0.82% 🔺)
@sentry/browser - Webpack (minified) 81.29 KB (-1.41% 🔽)
@sentry/react - Webpack (gzipped + minified) 23.45 KB (+0.84% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 47.99 KB (-0.03% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.07 KB (+0.35% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.43 KB (+0.11% 🔺)

@lforst lforst force-pushed the lforst-setup-integrations-refactor branch from c05dbb9 to 54f8512 Compare April 20, 2022 08:08
@lforst lforst marked this pull request as ready for review April 20, 2022 08:10
@lforst lforst requested review from Lms24 and AbhiPrasad April 20, 2022 08:10
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

LGTM. Just left a general question which came to my mind while reviewing. If this is something we wanna change it could also go into a separate PR.

Comment on lines +67 to +73
integrationIndex[integration.name] = integration;

if (installedIntegrations.indexOf(integration.name) === -1) {
integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
installedIntegrations.push(integration.name);
IS_DEBUG_BUILD && logger.log(`Integration installed: ${integration.name}`);
}
Copy link
Member

Choose a reason for hiding this comment

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

More of a question than anything else, especially since this PR doesn't change anything in this regard : Can setupOnce fail? Currently, each integration is added to integrationIndex (which according to the JSdoc holds all set up integrations) before it is installed. This means that the index could hold integrations that actually aren't installed if setupOnce fails (?).

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. Looking at some integrations, it seems they are generally designed in a way that doesn't throw, but just returns if anything goes wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants