Skip to content

Commit c97e311

Browse files
Use shouldAutoSave when closing widget (#15502)
1 parent 41ad6b4 commit c97e311

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,12 @@ export class SaveableService implements FrontendApplicationContribution {
222222
if (!Saveable.isDirty(widget)) {
223223
return false;
224224
}
225-
if (this.autoSave !== 'off') {
225+
const saveable = Saveable.get(widget);
226+
if (!saveable) {
227+
console.warn('Saveable.get returned undefined on a known saveable widget. This is unexpected.');
228+
}
229+
// Enter branch if saveable absent since we cannot check autosaveability more definitely.
230+
if (this.autoSave !== 'off' && (!saveable || this.shouldAutoSave(widget, saveable))) {
226231
return true;
227232
}
228233
const notLastWithDocument = !Saveable.closingWidgetWouldLoseSaveable(widget, Array.from(this.saveThrottles.keys()));

0 commit comments

Comments
 (0)