Skip to content

Commit 16ce735

Browse files
author
Andrea Barbasso
committed
[DSC-1570] fix wrong usage of datadogRum library
1 parent 8e5bf8b commit 16ce735

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/app/shared/datadog-rum/datadog-rum.service.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export class DatadogRumService {
1111

1212
consentUpdates$: BehaviorSubject<CookieConsents>;
1313
isDatadogInitialized = false;
14+
isDatadogRunning = false;
1415

1516
constructor(
1617
private klaroService: KlaroService
@@ -26,12 +27,15 @@ export class DatadogRumService {
2627
environment.datadogRum?.service && environment.datadogRum?.env) {
2728
if (!this.isDatadogInitialized) {
2829
this.isDatadogInitialized = true;
30+
this.isDatadogRunning = true;
2931
datadogRum.init(environment.datadogRum);
32+
} else if (!this.isDatadogRunning) {
33+
this.isDatadogRunning = true;
34+
datadogRum.startSessionReplayRecording();
3035
}
3136
} else {
32-
// TODO: if a session starts then stops then starts again an error is thrown. Is there an alternative to the .init method?
33-
datadogRum.stopSession();
34-
this.isDatadogInitialized = false;
37+
datadogRum.stopSessionReplayRecording();
38+
this.isDatadogRunning = false;
3539
}
3640
});
3741
}

0 commit comments

Comments
 (0)