Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to restore Theia state when webview and several editor tabs are opened #8621

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/core/src/browser/shell/shell-layout-restorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,21 +265,30 @@ export class ShellLayoutRestorer implements CommandContribution {
protected parse<T>(layoutData: string, parseContext: ShellLayoutRestorer.ParseContext): T {
return JSON.parse(layoutData, (property: string, value) => {
if (this.isWidgetsProperty(property)) {
const widgets: (Widget | undefined)[] = [];
const widgets: Widget[] = [];
const descs = (value as WidgetDescription[]);
for (let i = 0; i < descs.length; i++) {
parseContext.push(async context => {
widgets[i] = await this.convertToWidget(descs[i], context);
const widget = await this.convertToWidget(descs[i], context);
if (widget) {
// restoring of the widgets for the panel starts with the last widget
// to preserve the order, the new widget must be inserted at the start of the array
widgets.unshift(widget);
}
});
}

return widgets;
} else if (value && typeof value === 'object' && !Array.isArray(value)) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const copy: any = {};
for (const p in value) {
if (this.isWidgetProperty(p)) {
parseContext.push(async context => {
copy[p] = await this.convertToWidget(value[p], context);
const widget = await this.convertToWidget(value[p], context);
if (widget) {
copy[p] = widget;
}
});
} else {
copy[p] = value[p];
Expand Down