Avoid setting pendingOpCreatedAt for remote changes (#24542)

GitOrigin-RevId: 5d1684a743825cac23d486678b8f249cf0d152d8
This commit is contained in:
Alf Eaton
2025-03-27 09:06:02 +00:00
committed by Copybot
parent d67f3d3181
commit b14490d6aa
2 changed files with 3 additions and 2 deletions
@@ -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()
}
+1 -1
View File
@@ -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);
}