Skip to content

Commit

Permalink
Use a clean solution which requires a change in JupyterLab
Browse files Browse the repository at this point in the history
  • Loading branch information
krassowski committed Aug 19, 2024
1 parent bf3561e commit 4437fea
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions packages/docprovider/src/ydrive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,29 +192,16 @@ export class YDrive extends Drive implements ICollaborativeDrive {
const hashChange = hashChanges[0];

// A change in hash signifies that a save occurred on the server-side
// (e.g. a collaborator performed the save) - we want notify the observers
// about this change so that they can store the new hash value.

// (e.g. a collaborator performed the save) - we want to notify the
// observers about this change so that they can store the new hash value.
const model = await this.get(options.path, { content: false });
/*

this._ydriveFileChanged.emit({
type: 'server-side-save',
newValue: {...model, hash: hashChange.newValue},
type: 'save',
newValue: { ...model, hash: hashChange.newValue },
// we do not have the old model because it was discarded when server made the change,
// we only have the old hash here (which may be empty if the file was newly created!)
oldValue: {hash: hashChange.oldValue}
});
*/
// TODO: add handler for `server-side-save` in
// https://github.com/jupyterlab/jupyterlab/blob/dca1ec376c66038b8df7001d32cf058c70fcd717/packages/docregistry/src/context.ts#L410-L444
// For now, fake it:
// it happens that "rename" will perform the update of context's internal
// contentsModel (which we desire to solve the spurious "File Changed" dialog)
// even if file path has not changed.
this._ydriveFileChanged.emit({
type: 'rename',
newValue: { ...model, hash: hashChange.newValue },
oldValue: { ...model, hash: hashChange.oldValue }
oldValue: { hash: hashChange.oldValue }
});
});

Expand Down

0 comments on commit 4437fea

Please sign in to comment.