Skip to content

Commit

Permalink
Fix PxSpan assertion errors
Browse files Browse the repository at this point in the history
Do not take the new calculated width
when it is zero because the view is
temporarily not visible.
  • Loading branch information
cdamus committed May 25, 2023
1 parent 6dec259 commit d6dbb67
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ui/src/frontend/overview_timeline_panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d6dbb67

Please sign in to comment.