|
| 1 | +import { deepClone, isEmptyObject } from '@datadog/browser-core' |
1 | 2 | import type { RawRumViewEvent, RawRumViewUpdateEvent } from '../../rawRumEvent.types' |
2 | 3 | import { RumEventType } from '../../rawRumEvent.types' |
3 | | -import { deepClone, isEmptyObject } from '@datadog/browser-core' |
4 | 4 |
|
5 | 5 | /** |
6 | 6 | * Compare two values for deep equality |
@@ -126,10 +126,7 @@ function diffMerge( |
126 | 126 |
|
127 | 127 | // Object comparison - recurse (no options propagation: replaceKeys/appendKeys apply only at top level) |
128 | 128 | if (typeof currentVal === 'object' && lastSentVal && typeof lastSentVal === 'object') { |
129 | | - const nestedDiff = diffMerge( |
130 | | - currentVal as Record<string, unknown>, |
131 | | - lastSentVal as Record<string, unknown> |
132 | | - ) |
| 129 | + const nestedDiff = diffMerge(currentVal as Record<string, unknown>, lastSentVal as Record<string, unknown>) |
133 | 130 | if (nestedDiff && !isEmptyObject(nestedDiff)) { |
134 | 131 | result[key] = nestedDiff |
135 | 132 | } |
@@ -190,21 +187,17 @@ export function computeViewDiff( |
190 | 187 | } |
191 | 188 |
|
192 | 189 | // Diff view.* (MERGE, with custom_timings as REPLACE) |
193 | | - const viewDiff = diffMerge( |
194 | | - current.view as Record<string, unknown>, |
195 | | - lastSent.view as Record<string, unknown>, |
196 | | - { replaceKeys: new Set(['custom_timings']) } |
197 | | - ) |
| 190 | + const viewDiff = diffMerge(current.view as Record<string, unknown>, lastSent.view as Record<string, unknown>, { |
| 191 | + replaceKeys: new Set(['custom_timings']), |
| 192 | + }) |
198 | 193 | if (viewDiff) { |
199 | 194 | Object.assign(diff.view, viewDiff) |
200 | 195 | } |
201 | 196 |
|
202 | 197 | // Diff _dd.* (MERGE, with page_states as APPEND) |
203 | | - const ddDiff = diffMerge( |
204 | | - current._dd as Record<string, unknown>, |
205 | | - lastSent._dd as Record<string, unknown>, |
206 | | - { appendKeys: new Set(['page_states']) } |
207 | | - ) |
| 198 | + const ddDiff = diffMerge(current._dd as Record<string, unknown>, lastSent._dd as Record<string, unknown>, { |
| 199 | + appendKeys: new Set(['page_states']), |
| 200 | + }) |
208 | 201 | if (ddDiff) { |
209 | 202 | // Remove document_version from ddDiff (already in required fields) |
210 | 203 | delete ddDiff.document_version |
|
0 commit comments