Skip to content

Commit c3ffc5f

Browse files
authored
Correctly revert saveable on widget close (#14062)
1 parent 5af9da6 commit c3ffc5f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/core/src/browser/saveable-service.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,10 @@ export class SaveableService implements FrontendApplicationContribution {
174174
setDirty(saveableWidget, saveable.dirty);
175175
saveable.onDirtyChanged(() => setDirty(saveableWidget, saveable.dirty));
176176
const closeWithSaving = this.createCloseWithSaving();
177-
const closeWithoutSaving = () => this.closeWithoutSaving(saveableWidget, false);
177+
const closeWithoutSaving = async () => {
178+
const revert = Saveable.closingWidgetWouldLoseSaveable(saveableWidget, Array.from(this.saveThrottles.keys()));
179+
await this.closeWithoutSaving(saveableWidget, revert);
180+
};
178181
Object.assign(saveableWidget, {
179182
closeWithoutSaving,
180183
closeWithSaving,
@@ -224,7 +227,8 @@ export class SaveableService implements FrontendApplicationContribution {
224227
}
225228
const notLastWithDocument = !Saveable.closingWidgetWouldLoseSaveable(widget, Array.from(this.saveThrottles.keys()));
226229
if (notLastWithDocument) {
227-
return widget.closeWithoutSaving(false).then(() => undefined);
230+
await widget.closeWithoutSaving(false);
231+
return undefined;
228232
}
229233
if (options && options.shouldSave) {
230234
return options.shouldSave();

0 commit comments

Comments
 (0)