Skip to content

Commit 1801f8e

Browse files
authored
Revert "docs(js): Fix default integration examples (#11577)" (#11613)
This reverts commit 53c5a63.
1 parent 2c69355 commit 1801f8e

File tree

2 files changed

+27
-26
lines changed

2 files changed

+27
-26
lines changed

docs/platforms/javascript/common/best-practices/multiple-sentry-instances.mdx

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,18 @@ import {
3737
Scope,
3838
} from "@sentry/browser";
3939

40+
// filter integrations that use the global variable
41+
const integrations = getDefaultIntegrations({}).filter((defaultIntegration) => {
42+
return !["BrowserApiErrors", "Breadcrumbs", "GlobalHandlers"].includes(
43+
defaultIntegration.name
44+
);
45+
});
4046

4147
const client = new BrowserClient({
4248
dsn: "___PUBLIC_DSN___",
4349
transport: makeFetchTransport,
4450
stackParser: defaultStackParser,
45-
// filter integrations that use the global variable
46-
integrations: (defaultIntegrations) =>
47-
defaultIntegrations.filter(
48-
(integration) =>
49-
!["BrowserApiErrors", "Breadcrumbs", "GlobalHandlers"].includes(
50-
integration.name
51-
)
52-
),
51+
integrations: integrations,
5352
});
5453

5554
const scope = new Scope();
@@ -90,18 +89,20 @@ function happyIntegration() {
9089
};
9190
}
9291

92+
// filter integrations that use the global variable
93+
const integrations = Sentry.getDefaultIntegrations({}).filter(
94+
(defaultIntegration) => {
95+
return !["BrowserApiErrors", "Breadcrumbs", "GlobalHandlers"].includes(
96+
defaultIntegration.name
97+
);
98+
}
99+
);
93100

94101
const client1 = new Sentry.BrowserClient({
95102
dsn: "___PUBLIC_DSN___",
96103
transport: Sentry.makeFetchTransport,
97104
stackParser: Sentry.defaultStackParser,
98-
// filter integrations that use the global variable
99-
integrations: (defaultIntegrations) => [
100-
...defaultIntegrations.filter(
101-
(integration) => !["BrowserApiErrors", "Breadcrumbs", "GlobalHandlers"].includes(integration.name)
102-
),
103-
happyIntegration(),
104-
],
105+
integrations: [...integrations, happyIntegration()],
105106
beforeSend(event) {
106107
console.log("client 1", event);
107108
return null; // Returning `null` prevents the event from being sent
@@ -114,12 +115,7 @@ const client2 = new Sentry.BrowserClient({
114115
dsn: "___PUBLIC_DSN___", // Can be a different DSN
115116
transport: Sentry.makeFetchTransport,
116117
stackParser: Sentry.defaultStackParser,
117-
integrations: (defaultIntegrations) => [
118-
...defaultIntegrations.filter(
119-
(integration) => !["BrowserApiErrors", "Breadcrumbs", "GlobalHandlers"].includes(integration.name)
120-
),
121-
happyIntegration(),
122-
],
118+
integrations: [...integrations, happyIntegration()],
123119
beforeSend(event) {
124120
console.log("client 2", event);
125121
return null; // Returning `null` prevents the event from being sent

docs/platforms/javascript/common/best-practices/shared-environments.mdx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,20 @@ import {
5959
Scope,
6060
} from "@sentry/browser";
6161

62+
// filter integrations that use the global variable
63+
const integrations = getDefaultIntegrations({}).filter((defaultIntegration) => {
64+
return ![
65+
"BrowserApiErrors",
66+
"Breadcrumbs",
67+
"GlobalHandlers",
68+
].includes(defaultIntegration.name);
69+
});
70+
6271
const client = new BrowserClient({
6372
dsn: "___PUBLIC_DSN___",
6473
transport: makeFetchTransport,
6574
stackParser: defaultStackParser,
66-
// filter integrations that use the global variable
67-
integrations: (defaultIntegrations) =>
68-
defaultIntegrations.filter(
69-
(integration) => !["BrowserApiErrors", "Breadcrumbs", "GlobalHandlers"].includes(integration.name)
70-
),
75+
integrations: integrations,
7176
});
7277

7378
const scope = new Scope();

0 commit comments

Comments
 (0)