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 logging capture behaviour #1529

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

⚠️ No Changeset found

Latest commit: b985ffa112191c5d1ae5dcfc2f7bce569acc1492

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

pauldambra commented 3 months ago

ugh, the changeset command is very unhappy with something to do with how I've created this from our fork... I'll recreate