From a340d7adc922c31e029d7c99c09208e2b9986512 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Fri, 20 Sep 2024 11:34:05 -0700 Subject: [PATCH] [RPP] Support non-navigations in layout shift details track Bug: 366049346, 329735547 Change-Id: I7278434ecc4d5177b67efb2762b9bd4d16e1c79e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5878779 Auto-Submit: Connor Clark Commit-Queue: Adriana Ixba Reviewed-by: Adriana Ixba --- .../panels/timeline/components/LayoutShiftDetails.test.ts | 2 +- front_end/panels/timeline/components/LayoutShiftDetails.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/front_end/panels/timeline/components/LayoutShiftDetails.test.ts b/front_end/panels/timeline/components/LayoutShiftDetails.test.ts index 3a02f119fcd..ee572bef291 100644 --- a/front_end/panels/timeline/components/LayoutShiftDetails.test.ts +++ b/front_end/panels/timeline/components/LayoutShiftDetails.test.ts @@ -16,7 +16,7 @@ describeWithMockConnection('LayoutShiftDetails', () => { assert.isNotNull(shiftEvent); const details = new TimelineComponents.LayoutShiftDetails.LayoutShiftDetails(); - await details.setData(shiftEvent, insights, traceData, false); + details.setData(shiftEvent, insights, traceData, false); assert.isNotNull(details.shadowRoot); const decorativeChip = details.shadowRoot.querySelector('.timeline-details-chip-decorative-title'); diff --git a/front_end/panels/timeline/components/LayoutShiftDetails.ts b/front_end/panels/timeline/components/LayoutShiftDetails.ts index 3ff40a7c4a6..0678ef0c9ff 100644 --- a/front_end/panels/timeline/components/LayoutShiftDetails.ts +++ b/front_end/panels/timeline/components/LayoutShiftDetails.ts @@ -179,7 +179,8 @@ export class LayoutShiftDetails extends HTMLElement { } const ts = TraceEngine.Types.Timing.MicroSeconds(layoutShift.ts - traceEngineData.Meta.traceBounds.min); - const clsInsight = traceInsightsData.get(layoutShift.args.data?.navigationId ?? '')?.data.CumulativeLayoutShift; + const insightsId = layoutShift.args.data?.navigationId ?? TraceEngine.Insights.Types.NO_NAVIGATION; + const clsInsight = traceInsightsData.get(insightsId)?.data.CumulativeLayoutShift; if (clsInsight instanceof Error) { return null; }