rrweb
rrweb copied to clipboard
ref: Avoid cloning events to add `timestamp`
We are always passing in fresh objects to this method, so instead of cloning this into a new object, we can just put the timestamp on the given object directly and return it, saving a bit of processing cost.
🦋 Changeset detected
Latest commit: 065587aa4dc7861e9f1e96c02088cca8ec3e2f47
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 8 packages
| Name | Type |
|---|---|
| rrweb | Patch |
| rrweb-snapshot | Patch |
| rrdom | Patch |
| rrdom-nodejs | Patch |
| rrweb-player | Patch |
| @rrweb/types | Patch |
| @rrweb/web-extension | Patch |
| rrvideo | Patch |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
This is modifying the underlying object? Are you sure there aren't any typing problems with this, or possible knock on problems? (I can't think of anything over and above it being 'less clean')
Yes, but as far as I can tell we are always passing in a fresh object into this anyhow. We've been running this on our fork at Sentry without problems (as far as I can tell...) for some time now!
I've gone a bit further with #1441 to avoid that extra function call at all
And thank you for the contribution!
(I couldn't make commits directly to this PR)
(actually #1441 needs some more work)
#1441 is ready now as a larger change than this one
#1441 has been merged and I've tagged you in the merge commit, thank you for the PR!