diff --git a/services/web/frontend/js/features/ide-react/editor/share-js-doc.ts b/services/web/frontend/js/features/ide-react/editor/share-js-doc.ts index ef6a6d3776..b56d6443dd 100644 --- a/services/web/frontend/js/features/ide-react/editor/share-js-doc.ts +++ b/services/web/frontend/js/features/ide-react/editor/share-js-doc.ts @@ -93,7 +93,8 @@ export class ShareJsDoc extends EventEmitter { }) this._doc.setFlushDelay(SINGLE_USER_FLUSH_DELAY) this._doc.on('change', (...args: any[]) => { - if (!this.pendingOpCreatedAt) { + const isRemote = args[3] + if (!isRemote && !this.pendingOpCreatedAt) { debugConsole.log('set pendingOpCreatedAt', new Date()) this.pendingOpCreatedAt = performance.now() } diff --git a/services/web/frontend/js/vendor/libs/sharejs.js b/services/web/frontend/js/vendor/libs/sharejs.js index ffaf0ea4fb..a8bbdfaa78 100644 --- a/services/web/frontend/js/vendor/libs/sharejs.js +++ b/services/web/frontend/js/vendor/libs/sharejs.js @@ -959,7 +959,7 @@ export const { Doc } = (() => { // Its important that these event handlers are called with oldSnapshot. // The reason is that the OT type APIs might need to access the snapshots to // determine information about the received op. - this.emit('change', docOp, oldSnapshot, msg); + this.emit('change', docOp, oldSnapshot, msg, isRemote); if (isRemote) { return this.emit('remoteop', docOp, oldSnapshot, msg); }