Skip to content

Commit 7bc5c80

Browse files
committed
simplify checkAndHandleExpiredSession check
1 parent befae60 commit 7bc5c80

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

packages/replay/src/replay.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -603,8 +603,6 @@ export class ReplayContainer implements ReplayContainerInterface {
603603
* @hidden
604604
*/
605605
public checkAndHandleExpiredSession(): boolean | void {
606-
const oldSessionId = this.getSessionId();
607-
608606
// Prevent starting a new session if the last user activity is older than
609607
// SESSION_IDLE_PAUSE_DURATION. Otherwise non-user activity can trigger a new
610608
// session+recording. This creates noisy replays that do not have much
@@ -626,24 +624,11 @@ export class ReplayContainer implements ReplayContainerInterface {
626624
// --- There is recent user activity --- //
627625
// This will create a new session if expired, based on expiry length
628626
if (!this._checkSession()) {
629-
return;
630-
}
631-
632-
// Session was expired if session ids do not match
633-
const expired = oldSessionId !== this.getSessionId();
634-
635-
if (!expired) {
636-
return true;
637-
}
638-
639-
// Session is expired, trigger a full snapshot (which will create a new session)
640-
if (this.isPaused()) {
641-
this.resume();
642-
} else {
643-
this._triggerFullSnapshot();
627+
// Check session handles the refreshing itself
628+
return false;
644629
}
645630

646-
return false;
631+
return true;
647632
}
648633

649634
/**

0 commit comments

Comments
 (0)