Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix mutation edge case when blocked class gets unblocked
  • Loading branch information
rahulrelicx committed Mar 31, 2022
commit 7adc4ca0f792ead52638c6b6d4b1bcd52fc51245
3 changes: 2 additions & 1 deletion packages/rrweb/src/record/mutation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
isBlocked,
isAncestorRemoved,
isIgnored,
isSerialized,
isIframeINode,
hasShadowRoot,
} from '../utils';
Expand Down Expand Up @@ -532,7 +533,7 @@ export default class MutationBuffer {
const parentId = isShadowRoot(m.target)
? this.mirror.getId((m.target.host as unknown) as INode)
: this.mirror.getId(m.target as INode);
if (isBlocked(m.target, this.blockClass) || isIgnored(n)) {
if (isBlocked(m.target, this.blockClass) || isIgnored(n) || !isSerialized(n)) {
return;
}
// removed node has not been serialized yet, just remove it from the Set
Expand Down
4 changes: 4 additions & 0 deletions packages/rrweb/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ export function isBlocked(node: Node | null, blockClass: blockClass): boolean {
return isBlocked(node.parentNode, blockClass);
}

export function isSerialized(n: Node | INode): boolean {
return '__sn' in n;
}

export function isIgnored(n: Node | INode): boolean {
if ('__sn' in n) {
return (n as INode).__sn.id === IGNORED_NODE;
Expand Down