diff --git a/packages/core/src/browser/view-container.ts b/packages/core/src/browser/view-container.ts index 3536ec7491bc4..edef6bd736f4a 100644 --- a/packages/core/src/browser/view-container.ts +++ b/packages/core/src/browser/view-container.ts @@ -169,7 +169,12 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica return this.services.applicationStateService.state === 'ready'; } + protected lastVisibleState: ViewContainer.State | undefined; + storeState(): ViewContainer.State { + if (!this.isVisible && this.lastVisibleState) { + return this.lastVisibleState; + } const parts = this.layout.widgets; const availableSize = this.layout.getAvailableSize(); const orientation = this.orientation; @@ -345,6 +350,16 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica requestAnimationFrame(() => this.attached.resolve()); } + protected onBeforeHide(msg: Message): void { + super.onBeforeHide(msg); + this.lastVisibleState = this.storeState(); + } + + protected onAfterShow(msg: Message): void { + super.onAfterShow(msg); + this.lastVisibleState = undefined; + } + } export namespace ViewContainer {