Avoid setting pendingOpCreatedAt for remote changes (#24542)
GitOrigin-RevId: 5d1684a743825cac23d486678b8f249cf0d152d8
This commit is contained in:
@@ -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
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user