Skip to content

Commit

Permalink
fix #5815: preserve last visible view container state
Browse files Browse the repository at this point in the history
otherwise collapsed view containers are not restored

Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
  • Loading branch information
akosyakov committed Jul 31, 2019
1 parent 8d92f03 commit d294062
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/core/src/browser/view-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit d294062

Please sign in to comment.