From a3b299bd19687da30f75adf5c5bcc222e412eba8 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Wed, 11 Oct 2023 15:08:00 +0200 Subject: [PATCH] tabs - use lifecycle phase for delayed layout properly (#195360) --- .../workbench/browser/parts/editor/multiEditorTabsControl.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts b/src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts index 49e6bb73b9a..af5579120fd 100644 --- a/src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts +++ b/src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts @@ -1588,9 +1588,10 @@ export class MultiEditorTabsControl extends EditorTabsControl { if (this.visible) { // The layout of tabs can be an expensive operation because we access DOM properties // that can result in the browser doing a full page layout to validate them. To buffer - // this a little bit we try at least to schedule this work on the next animation frame. + // this a little bit we try at least to schedule this work on the next animation frame + // when we have restored or when idle otherwise. if (!this.layoutScheduler.value) { - const scheduledLayout = (this.lifecycleService.phase > LifecyclePhase.Restored ? scheduleAtNextAnimationFrame : runWhenIdle)(() => { + const scheduledLayout = (this.lifecycleService.phase >= LifecyclePhase.Restored ? scheduleAtNextAnimationFrame : runWhenIdle)(() => { this.doLayout(this.dimensions, this.layoutScheduler.value?.options /* ensure to pick up latest options */); this.layoutScheduler.clear();