diff --git a/.changeset/fast-colts-itch.md b/.changeset/fast-colts-itch.md new file mode 100644 index 0000000000..8928dd74d5 --- /dev/null +++ b/.changeset/fast-colts-itch.md @@ -0,0 +1,5 @@ +--- +'rrweb': patch +--- + +ref: Avoid cloning events to add `timestamp` diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index 7308ac6d04..f1c7e9f156 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -41,10 +41,9 @@ import { } from './error-handler'; function wrapEvent(e: event): eventWithTime { - return { - ...e, - timestamp: nowTimestamp(), - }; + const eWithTime = e as eventWithTime; + eWithTime.timestamp = nowTimestamp(); + return eWithTime; } let wrappedEmit!: (e: eventWithTime, isCheckout?: boolean) => void;