Skip to content

Commit 5f6a4ce

Browse files
Backport PR #16900: Abort saving if a file cannot be saved (#17046)
Co-authored-by: Jason Weill <[email protected]>
1 parent 9c557f0 commit 5f6a4ce

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/docregistry/src/context.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,14 @@ export class Context<
596596

597597
try {
598598
await this._manager.ready;
599+
if (this._model.collaborative) {
600+
// Files cannot be saved in collaborative mode. The "save" command
601+
// is disabled in the UI, but if the user tries to save anyway, act
602+
// as though it succeeded.
603+
this._saveState.emit('completed');
604+
return Promise.resolve();
605+
}
606+
599607
const value = await this._maybeSave(options);
600608
if (this.isDisposed) {
601609
return;
@@ -792,7 +800,7 @@ export class Context<
792800
}
793801

794802
/**
795-
* Add a checkpoint the file is writable.
803+
* Add a checkpoint if the file is writable.
796804
*/
797805
private _maybeCheckpoint(force: boolean): Promise<void> {
798806
let promise = Promise.resolve(void 0);

0 commit comments

Comments
 (0)