-
-
Couldn't load subscription status.
- Fork 1.6k
fix: move a console log to the warn method so it can be suppressed #1712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 5a1cb93 The changes in this PR will be included in the next version bump. This PR includes changesets to release 19 packages
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures empty CDATA nodes are safely skipped and that warning messages respect the configured logger.
- Swap direct
console.warncalls inReplayerto usethis.warnso messages obey the provided config. - Add a guard in
buildNodeto returnnullinstead of throwing on empty CDATA content.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/rrweb/src/replay/index.ts | Replaced console.warn(e) with this.warn(e) in the replay loop |
| packages/rrweb-snapshot/src/rebuild.ts | Added if (n.textContent.trim() === '') return null for CDATA |
Comments suppressed due to low confidence (3)
packages/rrweb-snapshot/src/rebuild.ts:435
- Add a unit test case for empty CDATA nodes to verify that this guard prevents exceptions and returns
nullas intended.
if (n.textContent.trim() === '') {
packages/rrweb-snapshot/src/rebuild.ts:435
- Document this new behavior in the function's JSDoc or comments, clarifying that empty CDATA sections will now be skipped by returning
null.
if (n.textContent.trim() === '') {
packages/rrweb-snapshot/src/rebuild.ts:435
- Introducing a null return here may violate the function's expected return type and could cause null dereference errors downstream. Consider updating the return type signature or ensuring callers handle
null.
if (n.textContent.trim() === '') {
noticed this while doing something else
this call to
console.warnis direct so it doesn't obey the provided configlet's make it play nicely