From 287b2b38f4714ce3297c2a31bbd3fa947d3b448a Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Fri, 7 Jun 2024 22:47:42 +0100 Subject: [PATCH] fix --- src/extensions/replay/sessionrecording.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/extensions/replay/sessionrecording.ts b/src/extensions/replay/sessionrecording.ts index 4fee89594..57d778c97 100644 --- a/src/extensions/replay/sessionrecording.ts +++ b/src/extensions/replay/sessionrecording.ts @@ -138,12 +138,14 @@ const newQueuedEvent = (rrwebMethod: () => void): QueuedRRWebEvent => ({ const LOGGER_PREFIX = '[SessionRecording]' +// taken from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cyclic_object_value#circular_references function circularReferenceReplacer() { const ancestors: any[] = [] return function (_key: string, value: any) { if (isObject(value)) { // `this` is the object that value is contained in, // i.e., its direct parent. + // @ts-expect-error - TS was unhappy with `this` on the next line but the code is copied in from MDN while (ancestors.length > 0 && ancestors.at(-1) !== this) { ancestors.pop() }