Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
4 changes: 2 additions & 2 deletions packages/replay-internal/src/types/performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ export interface WebVitalData {
/**
* The recording id of the web vital nodes. -1 if not found
*/
nodeIds?: number[];
nodeIds: number[] | undefined;
/**
* The layout shifts of a CLS metric
*/
attributions?: { value: number; nodeIds?: number[] }[];
attributions: { value: number; nodeIds: number[] | undefined }[] | undefined;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface LayoutShiftAttribution {

interface Attribution {
value: number;
nodeIds?: number[];
nodeIds: number[] | undefined;
}

/**
Expand Down Expand Up @@ -220,9 +220,10 @@ export function getCumulativeLayoutShift(metric: Metric): ReplayPerformanceEntry
}
}
}
layoutShifts.push({ value: entry.value, nodeIds });
layoutShifts.push({ value: entry.value, nodeIds: nodeIds.length ? nodeIds : undefined });
}
}

return getWebVital(metric, 'cumulative-layout-shift', nodes, layoutShifts);
}

Expand Down Expand Up @@ -258,7 +259,7 @@ function getWebVital(

const end = getAbsoluteTime(value);

const data: ReplayPerformanceEntry<WebVitalData> = {
return {
type: 'web-vital',
name,
start: end,
Expand All @@ -271,6 +272,4 @@ function getWebVital(
attributions,
},
};

return data;
}
Loading