Skip to content

Commit e044288

Browse files
Connor ClarkDevtools-frontend LUCI CQ
authored andcommitted
[AI] Format CLS using 2 decimals.
Bug: none Change-Id: Ia367c97d1270d54e8d5f05da953603829c9ef9ba Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6882336 Commit-Queue: Connor Clark <[email protected]> Reviewed-by: Paul Irish <[email protected]> Auto-Submit: Connor Clark <[email protected]> Commit-Queue: Paul Irish <[email protected]>
1 parent 6e4ac0b commit e044288

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ ${filesFormatted}`;
437437
return Object.entries(this.#insight.metricSavings ?? {})
438438
.map(([k, v]) => {
439439
if (k === 'CLS') {
440-
return `${k} ${v}`;
440+
return `${k} ${v.toFixed(2)}`;
441441
}
442-
return `${k} ${v} ms`;
442+
return `${k} ${Math.round(v)} ms`;
443443
})
444444
.join(', ');
445445
}

front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ Metrics:
497497
- LCP: 118 ms, event: (eventKey: r-1802, ts: 1020034953358)
498498
- TTFB: 31.3 ms, bounds: {min: 1020034834921, max: 1020034866264}
499499
- Render delay: 87 ms, bounds: {min: 1020034866264, max: 1020034953358}
500-
- CLS: 0
500+
- CLS: 0.00
501501
Available insights:
502502
- insight name: LCPBreakdown
503503
description: Each [subpart has specific improvement strategies](https://web.dev/articles/optimize-lcp#lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
@@ -526,7 +526,7 @@ Metrics:
526526
- Load delay: 90.3 ms, bounds: {min: 157423704371, max: 157423794709}
527527
- Load duration: 63.9 ms, bounds: {min: 157423794709, max: 157423858674}
528528
- Render delay: 94.4 ms, bounds: {min: 157423858674, max: 157423953162}
529-
- CLS: 0.043065690033645056, event: (eventKey: s--1, ts: 157425604232)
529+
- CLS: 0.04, event: (eventKey: s--1, ts: 157425604232)
530530
Available insights:
531531
- insight name: LCPBreakdown
532532
description: Each [subpart has specific improvement strategies](https://web.dev/articles/optimize-lcp#lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.

front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export class PerformanceTraceFormatter {
7777
}
7878
if (cls) {
7979
const eventText = cls.worstClusterEvent ? `, event: ${this.serializeEvent(cls.worstClusterEvent)}` : '';
80-
parts.push(` - CLS: ${cls.value}${eventText}`);
80+
parts.push(` - CLS: ${cls.value.toFixed(2)}${eventText}`);
8181
}
8282
} else {
8383
parts.push('Metrics: n/a');

0 commit comments

Comments
 (0)