Эх сурвалжийг харах

Avoid setting pendingOpCreatedAt for remote changes (#24542)

GitOrigin-RevId: 5d1684a743825cac23d486678b8f249cf0d152d8
Alf Eaton 1 жил өмнө
parent
commit
b14490d6aa

+ 2 - 1
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()
       }

+ 1 - 1
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);
         }