rrweb-io / rrweb

record and replay the web
https://www.rrweb.io/
MIT License
16.61k stars 1.42k forks source link

fix: console assert only logs when arg 0 is falsy #1530

Closed pauldambra closed 3 months ago

pauldambra commented 3 months ago

fixes https://github.com/PostHog/posthog-js/issues/1280

when someone calls console.assert the console recorder always captures as if the log was shown in the console

but...

The console.assert() static method writes an error message to the console if the assertion is false. If the assertion is true, nothing happens.

from https://developer.mozilla.org/en-US/docs/Web/API/console/assert_static

this changes the recorder to only capture when the assertion is false, and not to log the first argument, which brings the recorded logs into line with what the browser would do

technically this is a breaking change since folk could be depending on this incorrect behaviour, i chose not to wrap it in config allowing people to opt in to this new behaviour to keep the change simpler (but open to adding that if necessary)

my educated guess is that use of console.assert is pretty rare

changeset-bot[bot] commented 3 months ago

🦋 Changeset detected

Latest commit: 49fcecb63d2bc44e0212a16de4721c4e0095a91f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 18 packages | Name | Type | | ---------------------------------------- | ----- | | @rrweb/rrweb-plugin-console-record | Patch | | rrweb | Patch | | rrweb-snapshot | Patch | | rrdom | Patch | | rrdom-nodejs | Patch | | rrweb-player | Patch | | @rrweb/all | Patch | | @rrweb/replay | Patch | | @rrweb/record | Patch | | @rrweb/types | Patch | | @rrweb/packer | Patch | | @rrweb/web-extension | Patch | | rrvideo | Patch | | @rrweb/rrweb-plugin-console-replay | Patch | | @rrweb/rrweb-plugin-sequential-id-record | Patch | | @rrweb/rrweb-plugin-sequential-id-replay | Patch | | @rrweb/rrweb-plugin-canvas-webrtc-record | Patch | | @rrweb/rrweb-plugin-canvas-webrtc-replay | 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

pauldambra commented 3 months ago

I thought i'd only asked for a patch bump to one package, i guess i did that wrong 🙈

pauldambra commented 3 months ago

🚀 nice! thanks @Juice10