wip(sync): do not consume own payloads

django-channels broadcast even to the sender, so let's drop that payloads.
This commit is contained in:
Yohan Boniface 2024-12-26 15:28:51 +01:00
parent 4cc9540119
commit f7572c4893

View file

@ -124,7 +124,7 @@ export class SyncEngine {
if (this.offline) return if (this.offline) return
if (this.transport) { if (this.transport) {
this.transport.send('OperationMessage', message) this.transport.send('OperationMessage', { sender: this.uuid, ...message })
} }
} }
@ -177,6 +177,7 @@ export class SyncEngine {
* @param {Object} payload * @param {Object} payload
*/ */
onOperationMessage(payload) { onOperationMessage(payload) {
if (payload.sender === this.uuid) return
this._operations.storeRemoteOperations([payload]) this._operations.storeRemoteOperations([payload])
this._applyOperation(payload) this._applyOperation(payload)
} }