Skip to content

Commit 837bbd1

Browse files
authored
ref: Make setupOnce optional in integrations (#10729)
This is now properly optional 🎉
1 parent e4dc5a7 commit 837bbd1

37 files changed

+26
-94
lines changed

packages/browser/src/integrations/breadcrumbs.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ const _breadcrumbsIntegration = ((options: Partial<BreadcrumbsOptions> = {}) =>
7070

7171
return {
7272
name: INTEGRATION_NAME,
73-
// TODO v8: Remove this
74-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
7573
setup(client) {
7674
if (_options.console) {
7775
addConsoleInstrumentationHandler(_getConsoleBreadcrumbHandler(client));

packages/browser/src/integrations/dedupe.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const _dedupeIntegration = (() => {
1111

1212
return {
1313
name: INTEGRATION_NAME,
14-
// TODO v8: Remove this
15-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1614
processEvent(currentEvent) {
1715
// We want to ignore any non-error type events, e.g. transactions or replays
1816
// These should never be deduped, and also not be compared against as _previousEvent.

packages/browser/src/integrations/httpcontext.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ const INTEGRATION_NAME = 'HttpContext';
88
const _httpContextIntegration = (() => {
99
return {
1010
name: INTEGRATION_NAME,
11-
// TODO v8: Remove this
12-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1311
preprocessEvent(event) {
1412
// if none of the information we want exists, don't bother
1513
if (!WINDOW.navigator && !WINDOW.location && !WINDOW.document) {

packages/browser/src/integrations/linkederrors.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ const _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {
1919

2020
return {
2121
name: INTEGRATION_NAME,
22-
// TODO v8: Remove this
23-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2422
preprocessEvent(event, hint, client) {
2523
const options = client.getOptions();
2624

packages/browser/src/profiling/integration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const _browserProfilingIntegration = (() => {
2222
return {
2323
name: INTEGRATION_NAME,
2424
// TODO v8: Remove this
25-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2625
setup(client) {
2726
const scope = getCurrentScope();
2827

packages/core/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ export function setupIntegration(client: Client, integration: Integration, integ
129129
integrationIndex[integration.name] = integration;
130130

131131
// `setupOnce` is only called the first time
132-
if (installedIntegrations.indexOf(integration.name) === -1) {
132+
if (installedIntegrations.indexOf(integration.name) === -1 && typeof integration.setupOnce === 'function') {
133133
// eslint-disable-next-line deprecation/deprecation
134134
integration.setupOnce(addGlobalEventProcessor, getCurrentHub);
135135
installedIntegrations.push(integration.name);

packages/core/src/integrations/inboundfilters.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ const INTEGRATION_NAME = 'InboundFilters';
3333
const _inboundFiltersIntegration = ((options: Partial<InboundFiltersOptions> = {}) => {
3434
return {
3535
name: INTEGRATION_NAME,
36-
// TODO v8: Remove this
37-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
3836
processEvent(event, _hint, client) {
3937
const clientOptions = client.getOptions();
4038
const mergedOptions = _mergeOptions(options, clientOptions);

packages/core/src/integrations/linkederrors.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ const _linkedErrorsIntegration = ((options: LinkedErrorsOptions = {}) => {
1818

1919
return {
2020
name: INTEGRATION_NAME,
21-
// TODO v8: Remove this
22-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
2321
preprocessEvent(event, hint, client) {
2422
const options = client.getOptions();
2523

packages/core/src/integrations/metadata.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const INTEGRATION_NAME = 'ModuleMetadata';
99
const _moduleMetadataIntegration = (() => {
1010
return {
1111
name: INTEGRATION_NAME,
12-
// TODO v8: Remove this
13-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
1412
setup(client) {
1513
// We need to strip metadata from stack frames before sending them to Sentry since these are client side only.
1614
client.on('beforeEnvelope', envelope => {

packages/core/src/integrations/requestdata.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ const _requestDataIntegration = ((options: RequestDataIntegrationOptions = {}) =
7575

7676
return {
7777
name: INTEGRATION_NAME,
78-
// TODO v8: Remove this
79-
setupOnce() {}, // eslint-disable-line @typescript-eslint/no-empty-function
8078
processEvent(event, _hint, client) {
8179
// Note: In the long run, most of the logic here should probably move into the request data utility functions. For
8280
// the moment it lives here, though, until https://github.com/getsentry/sentry-javascript/issues/5718 is addressed.

0 commit comments

Comments
 (0)