Skip to content

Commit 4437fea

Browse files
committed
Use a clean solution which requires a change in JupyterLab
1 parent bf3561e commit 4437fea

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

packages/docprovider/src/ydrive.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -192,29 +192,16 @@ export class YDrive extends Drive implements ICollaborativeDrive {
192192
const hashChange = hashChanges[0];
193193

194194
// A change in hash signifies that a save occurred on the server-side
195-
// (e.g. a collaborator performed the save) - we want notify the observers
196-
// about this change so that they can store the new hash value.
197-
195+
// (e.g. a collaborator performed the save) - we want to notify the
196+
// observers about this change so that they can store the new hash value.
198197
const model = await this.get(options.path, { content: false });
199-
/*
198+
200199
this._ydriveFileChanged.emit({
201-
type: 'server-side-save',
202-
newValue: {...model, hash: hashChange.newValue},
200+
type: 'save',
201+
newValue: { ...model, hash: hashChange.newValue },
203202
// we do not have the old model because it was discarded when server made the change,
204203
// we only have the old hash here (which may be empty if the file was newly created!)
205-
oldValue: {hash: hashChange.oldValue}
206-
});
207-
*/
208-
// TODO: add handler for `server-side-save` in
209-
// https://github.com/jupyterlab/jupyterlab/blob/dca1ec376c66038b8df7001d32cf058c70fcd717/packages/docregistry/src/context.ts#L410-L444
210-
// For now, fake it:
211-
// it happens that "rename" will perform the update of context's internal
212-
// contentsModel (which we desire to solve the spurious "File Changed" dialog)
213-
// even if file path has not changed.
214-
this._ydriveFileChanged.emit({
215-
type: 'rename',
216-
newValue: { ...model, hash: hashChange.newValue },
217-
oldValue: { ...model, hash: hashChange.oldValue }
204+
oldValue: { hash: hashChange.oldValue }
218205
});
219206
});
220207

0 commit comments

Comments
 (0)