Skip to content
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

⚡️ [RUMF-902] enable new mutation observer #842

Merged
merged 9 commits into from
May 12, 2021
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ describe('serializeNodeWithId', () => {
describe('ignores some nodes', () => {
const defaultOptions = {
doc: document,
skipChild: false,
map: {},
}

Expand Down
7 changes: 2 additions & 5 deletions packages/rum-recorder/src/domain/rrweb-snapshot/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,10 @@ export function serializeNodeWithId(
options: {
doc: Document
map: IdNodeMap
skipChild: boolean
preserveWhiteSpace?: boolean
}
): SerializedNodeWithId | null {
const { doc, map, skipChild = false } = options
const { doc, map } = options
let { preserveWhiteSpace = true } = options
const serializedNode = serializeNode(n, {
doc,
Expand Down Expand Up @@ -399,7 +398,7 @@ export function serializeNodeWithId(
return null
}
map[id] = true
let recordChild = !skipChild
let recordChild = true
if (serializedNode.type === NodeType.Element) {
recordChild = recordChild && !serializedNode.shouldBeHidden
BenoitZugmeyer marked this conversation as resolved.
Show resolved Hide resolved
// this property was not needed in replay side
Expand All @@ -417,7 +416,6 @@ export function serializeNodeWithId(
const serializedChildNode = serializeNodeWithId(childN, {
doc,
map,
skipChild,
preserveWhiteSpace,
})
if (serializedChildNode) {
Expand All @@ -434,7 +432,6 @@ export function snapshot(n: Document): [SerializedNodeWithId | null, IdNodeMap]
serializeNodeWithId(n, {
doc: n,
map: idNodeMap,
skipChild: false,
}),
idNodeMap,
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function processChildListMutations(mutations: Array<WithSerializedTarget<ChildLi
continue
}

const serializedNode = serializeNodeWithId(node, { doc: document, map: serializedNodesIdMap, skipChild: false })
const serializedNode = serializeNodeWithId(node, { doc: document, map: serializedNodesIdMap })
if (!serializedNode) {
continue
}
Expand Down