Skip to content

Commit

Permalink
Update to new state if there is no current state
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy081 committed Dec 8, 2017
1 parent fc312d7 commit d1c1116
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/vs/workbench/browser/parts/views/viewsViewlet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -617,12 +617,15 @@ export class ViewsViewlet extends PanelViewlet {
}

private updateViewStateSize(view: ViewsViewletPanel): void {
if (this.didLayout) {
const currentState = this.viewsStates.get(view.id);
const newViewState = this.createViewState(view);
const stateToUpdate = currentState ? { ...currentState, collapsed: newViewState.collapsed, size: newViewState.size } : newViewState;
this.viewsStates.set(view.id, stateToUpdate);
const currentState = this.viewsStates.get(view.id);
if (currentState && !this.didLayout) {
// Do not update to new state if the layout has not happened yet
return;
}

const newViewState = this.createViewState(view);
const stateToUpdate = currentState ? { ...currentState, collapsed: newViewState.collapsed, size: newViewState.size } : newViewState;
this.viewsStates.set(view.id, stateToUpdate);
}

protected createViewState(view: ViewsViewletPanel): IViewState {
Expand Down

0 comments on commit d1c1116

Please sign in to comment.