Skip to content

Commit

Permalink
fix test + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
c298lee committed Jul 22, 2024
1 parent 77a12ac commit 477f926
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 6 additions & 1 deletion packages/replay-internal/src/types/replayFrame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,12 @@ interface ReplayHistoryFrame extends ReplayBaseSpanFrame {

interface ReplayWebVitalFrame extends ReplayBaseSpanFrame {
data: WebVitalData;
op: 'largest-contentful-paint' | 'cumulative-layout-shift' | 'first-input-delay' | 'interaction-to-next-paint' | 'time-to-first-byte';
op:
| 'largest-contentful-paint'
| 'cumulative-layout-shift'
| 'first-input-delay'
| 'interaction-to-next-paint'
| 'time-to-first-byte';
}

interface ReplayMemoryFrame extends ReplayBaseSpanFrame {
Expand Down
8 changes: 5 additions & 3 deletions packages/replay-internal/src/util/createPerformanceEntries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,14 @@ export function getLargestContentfulPaint(metric: Metric): ReplayPerformanceEntr
* Add a CLS event to the replay based on a CLS metric.
*/
export function getCumulativeLayoutShift(metric: Metric): ReplayPerformanceEntry<WebVitalData> {
const lastEntry = metric.entries[metric.entries.length - 1] as (PerformanceEntry & { sources?: LayoutShiftAttribution[] }) | undefined;
const lastEntry = metric.entries[metric.entries.length - 1] as
| (PerformanceEntry & { sources?: LayoutShiftAttribution[] })
| undefined;
const nodes: Node[] = [];
if (lastEntry && lastEntry.sources) {
for (const source of lastEntry.sources) {
if (source.node) {
nodes.push(source.node)
nodes.push(source.node);
}

}
Expand Down Expand Up @@ -251,7 +253,7 @@ export function getWebVital(
}
} else {
if (node) {
nodeIds.push(record.mirror.getId(node))
nodeIds.push(record.mirror.getId(node));
}
}

Expand Down

0 comments on commit 477f926

Please sign in to comment.