Skip to content

Commit

Permalink
Backport PR #16900: Abort saving if a file cannot be saved (#17046)
Browse files Browse the repository at this point in the history
Co-authored-by: Jason Weill <93281816+JasonWeill@users.noreply.github.com>
  • Loading branch information
meeseeksmachine and JasonWeill authored Dec 5, 2024
1 parent 9c557f0 commit 5f6a4ce
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/docregistry/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,14 @@ export class Context<

try {
await this._manager.ready;
if (this._model.collaborative) {
// Files cannot be saved in collaborative mode. The "save" command
// is disabled in the UI, but if the user tries to save anyway, act
// as though it succeeded.
this._saveState.emit('completed');
return Promise.resolve();
}

const value = await this._maybeSave(options);
if (this.isDisposed) {
return;
Expand Down Expand Up @@ -792,7 +800,7 @@ export class Context<
}

/**
* Add a checkpoint the file is writable.
* Add a checkpoint if the file is writable.
*/
private _maybeCheckpoint(force: boolean): Promise<void> {
let promise = Promise.resolve(void 0);
Expand Down

0 comments on commit 5f6a4ce

Please sign in to comment.