diff --git a/cmp/viewmanager/ViewManagerModel.ts b/cmp/viewmanager/ViewManagerModel.ts index a6a656ac2..9118912ab 100644 --- a/cmp/viewmanager/ViewManagerModel.ts +++ b/cmp/viewmanager/ViewManagerModel.ts @@ -346,14 +346,19 @@ export class ViewManagerModel extends HoistModel { } } - async selectViewAsync(info: ViewInfo): Promise { + async selectViewAsync(info: ViewInfo, opts = {alertUnsavedChanges: true}): Promise { // ensure any pending auto-save gets completed if (this.isValueDirty && this.isViewAutoSavable) { await this.maybeAutoSaveAsync(); } // if still dirty, require confirm - if (this.isValueDirty && this.view.isOwned && !(await this.confirmDiscardChangesAsync())) { + if ( + opts.alertUnsavedChanges && + this.isValueDirty && + this.view.isOwned && + !(await this.confirmDiscardChangesAsync()) + ) { return; }