From d7cf8dd07547f6fb22ef82e341a88357c4053bd3 Mon Sep 17 00:00:00 2001 From: Colin Maxfield Date: Wed, 29 May 2024 07:35:25 -0400 Subject: [PATCH] Return early for child same origin frames (#1295) --- .changeset/silent-plants-perform.md | 5 +++++ packages/rrweb/src/record/index.ts | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/silent-plants-perform.md diff --git a/.changeset/silent-plants-perform.md b/.changeset/silent-plants-perform.md new file mode 100644 index 0000000000..b87aaa908c --- /dev/null +++ b/.changeset/silent-plants-perform.md @@ -0,0 +1,5 @@ +--- +'rrweb': patch +--- + +Return early for child same origin frames diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 484a8a7ecb..080cf14549 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -122,6 +122,11 @@ function record( if (inEmittingFrame && !emit) { throw new Error('emit function is required'); } + if (!inEmittingFrame && !passEmitsToParent) { + return () => { + /* no-op since in this case we don't need to record anything from this frame in particular */ + }; + } // move departed options to new options if (mousemoveWait !== undefined && sampling.mousemove === undefined) { sampling.mousemove = mousemoveWait;