diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 1c2141bfef..cdac7f36b1 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -114,6 +114,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;