Skip to content

Commit

Permalink
tabs - use lifecycle phase for delayed layout properly (#195360)
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero authored Oct 11, 2023
1 parent 13ba501 commit a3b299b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit a3b299b

Please sign in to comment.