Skip to content

Commit

Permalink
[shell] catch errors on restore layout and default to initialization (f…
Browse files Browse the repository at this point in the history
…ixes eclipse-theia#1075)

Signed-off-by: Sven Efftinge <sven.efftinge@typefox.io>
  • Loading branch information
svenefftinge committed Jan 22, 2018
1 parent 241e254 commit 467603e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions packages/core/src/browser/shell/shell-layout-restorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,19 @@ export class ShellLayoutRestorer implements CommandContribution {
}

async initializeLayout(app: FrontendApplication, contributions: FrontendApplicationContribution[]): Promise<void> {
const serializedLayoutData = await this.storageService.getData<string>(this.storageKey);
if (serializedLayoutData !== undefined) {
const layoutData = await this.inflate(serializedLayoutData);
app.shell.setLayoutData(layoutData);
} else {
for (const initializer of contributions) {
if (initializer.initializeLayout) {
await initializer.initializeLayout(app);
}
try {
const serializedLayoutData = await this.storageService.getData<string>(this.storageKey);
if (serializedLayoutData !== undefined) {
const layoutData = await this.inflate(serializedLayoutData);
app.shell.setLayoutData(layoutData);
return;
}
} catch (e) {
this.logger.debug(e);
}
for (const initializer of contributions) {
if (initializer.initializeLayout) {
await initializer.initializeLayout(app);
}
}
}
Expand Down

0 comments on commit 467603e

Please sign in to comment.