From d6dbb67c5e381473ee482cf8c3b53460216c5571 Mon Sep 17 00:00:00 2001 From: "Christian W. Damus" Date: Wed, 24 May 2023 16:22:12 -0400 Subject: [PATCH] Fix PxSpan assertion errors Do not take the new calculated width when it is zero because the view is temporarily not visible. --- ui/src/frontend/overview_timeline_panel.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/frontend/overview_timeline_panel.ts b/ui/src/frontend/overview_timeline_panel.ts index dc8a45d5a4..e5523131bd 100644 --- a/ui/src/frontend/overview_timeline_panel.ts +++ b/ui/src/frontend/overview_timeline_panel.ts @@ -49,7 +49,10 @@ export class OverviewTimelinePanel extends Panel { // Must explicitly type now; arguments types are no longer auto-inferred. // https://github.com/Microsoft/TypeScript/issues/1373 onupdate({dom}: m.CVnodeDOM) { - this.width = dom.getBoundingClientRect().width; + const newWidth = dom.getBoundingClientRect().width; + if (newWidth > 0) { // It may be zero when temporarily not visible + this.width = newWidth; + } this.traceTime = globals.stateTraceTimeTP(); const traceTime = globals.stateTraceTime(); const pxSpan = new PxSpan(TRACK_SHELL_WIDTH, this.width);