Skip to content

Commit d307cf0

Browse files
🎨 [PANA-6365] Fix type definition for RumMutationRecord (#4306)
1 parent 083ef39 commit d307cf0

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎packages/rum-core/src/browser/domMutationObservable.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export interface RumAttributesMutationRecord {
1111
type: 'attributes'
1212
target: Element
1313
oldValue: string | null
14-
attributeName: string | null
14+
attributeName: string
1515
}
1616

1717
export interface RumChildListMutationRecord {

‎packages/rum/src/domain/record/serialization/serializeMutations.ts‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,21 +296,21 @@ function processAttributesMutations(
296296
const handledElements = new Map<Element, Set<string>>()
297297
const filteredMutations = mutations.filter((mutation) => {
298298
const handledAttributes = handledElements.get(mutation.target)
299-
if (handledAttributes && handledAttributes.has(mutation.attributeName!)) {
299+
if (handledAttributes && handledAttributes.has(mutation.attributeName)) {
300300
return false
301301
}
302302
if (!handledAttributes) {
303-
handledElements.set(mutation.target, new Set([mutation.attributeName!]))
303+
handledElements.set(mutation.target, new Set([mutation.attributeName]))
304304
} else {
305-
handledAttributes.add(mutation.attributeName!)
305+
handledAttributes.add(mutation.attributeName)
306306
}
307307
return true
308308
})
309309

310310
// Emit mutations
311311
const emittedMutations = new Map<Element, AttributeMutation>()
312312
for (const mutation of filteredMutations) {
313-
const uncensoredValue = mutation.target.getAttribute(mutation.attributeName!)
313+
const uncensoredValue = mutation.target.getAttribute(mutation.attributeName)
314314
if (uncensoredValue === mutation.oldValue) {
315315
continue
316316
}
@@ -328,7 +328,7 @@ function processAttributesMutations(
328328
const attributeValue = serializeAttribute(
329329
mutation.target,
330330
privacyLevel,
331-
mutation.attributeName!,
331+
mutation.attributeName,
332332
transaction.scope.configuration
333333
)
334334

@@ -352,7 +352,7 @@ function processAttributesMutations(
352352
emittedMutations.set(mutation.target, emittedMutation)
353353
}
354354

355-
emittedMutation.attributes[mutation.attributeName!] = transformedValue
355+
emittedMutation.attributes[mutation.attributeName] = transformedValue
356356
}
357357

358358
return attributeMutations

‎packages/rum/src/domain/record/serialization/serializeMutationsAsChange.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ function processMutations(mutations: RumMutationRecord[], transaction: ChangeSer
6161
attributes = new Map<AttributeName, OldValue>()
6262
attributeMutations.set(node, attributes)
6363
}
64-
const attributeName = mutation.attributeName!
64+
const attributeName = mutation.attributeName
6565
if (!attributes.has(attributeName)) {
6666
attributes.set(attributeName, mutation.oldValue)
6767
}

0 commit comments

Comments
 (0)