Skip to content

Commit 5b4df79

Browse files
authored
ref(angular): Update Replay lazy load instructions (#11291)
1 parent e8ab62d commit 5b4df79

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
```javascript {filename: main.ts} {3, 7-8}
1+
```javascript {filename: main.ts} {3, 6-7, 11-15}
22
Sentry.init({
33
// Note, replayIntegration is NOT instantiated below:
44
integrations: [],
5+
6+
// Replay sample rates still have to be set in `Sentry.init`:
7+
replaysSessionSampleRate: 0.1,
8+
replaysOnErrorSampleRate: 1.0,
59
});
610

711
// Sometime later
8-
import("@sentry/angular").then(lazyLoadedSentry => {
9-
Sentry.addIntegration(lazyLoadedSentry.replayIntegration());
12+
Sentry.lazyLoadIntegration("replayIntegration").then((replayIntegration) => {
13+
Sentry.addIntegration(replayIntegration());
1014
});
1115
```

platform-includes/session-replay/setup/javascript.angular.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ To learn more about Session Replay privacy, [read our docs.](/platforms/javascri
4949

5050
### Lazy-loading Replay
5151

52-
Once you've added the integration, Replay will start automatically. If you don't want to start it immediately (lazy-load it), you can use `addIntegration`:
52+
Once you've added the integration, Replay will start automatically. If you don't want to start it immediately (lazy-load it), you can use `lazyLoadIntegration`:
5353

5454
<PlatformContent includePath="configuration/integrations/lazy-loading-replay" />
55+
56+
You can lazy-load the `replayIntegration` directly in `main.ts` (as shown in the example) but also in other parts of your application, for example a lazy-loaded module or component.

0 commit comments

Comments
 (0)