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() }