Skip to content

Commit

Permalink
PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
c298lee committed Sep 6, 2024
1 parent ca8c3c2 commit 4f73c5c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
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[] | undefined;
nodeIds?: number[];
/**
* The layout shifts of a CLS metric
*/
attributions: { value: number; nodeIds: number[] | undefined }[] | undefined;
attributions?: { value: number; nodeIds: number[] | undefined }[];
}

/**
Expand Down
9 changes: 2 additions & 7 deletions packages/replay-internal/src/util/createPerformanceEntries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ interface LayoutShiftAttribution {
currentRect: DOMRectReadOnly;
}

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

/**
* Handler creater for web vitals
*/
Expand Down Expand Up @@ -206,7 +201,7 @@ function isLayoutShift(entry: PerformanceEntry): entry is LayoutShift {
* Add a CLS event to the replay based on a CLS metric.
*/
export function getCumulativeLayoutShift(metric: Metric): ReplayPerformanceEntry<WebVitalData> {
const layoutShifts: Attribution[] = [];
const layoutShifts: WebVitalData['attributions'] = [];
const nodes: Node[] = [];
for (const entry of metric.entries) {
if (isLayoutShift(entry)) {
Expand Down Expand Up @@ -252,7 +247,7 @@ function getWebVital(
metric: Metric,
name: string,
nodes: Node[] | undefined,
attributions?: Attribution[],
attributions?: WebVitalData['attributions'],
): ReplayPerformanceEntry<WebVitalData> {
const value = metric.value;
const rating = metric.rating;
Expand Down

0 comments on commit 4f73c5c

Please sign in to comment.