Skip to content

Commit 4f71d20

Browse files
committed
Address PR feedback
1 parent 1052acf commit 4f71d20

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/plugins/liveobjects/syncobjectspool.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ export class SyncObjectsPool {
4848
}
4949

5050
const objectState = objectMessage.object;
51+
52+
if (!objectState.counter && !objectState.map) {
53+
// RTO5f3
54+
this._client.Logger.logAction(
55+
this._client.logger,
56+
this._client.Logger.LOG_MAJOR,
57+
'SyncObjectsPool.applyObjectSyncMessages()',
58+
`received OBJECT_SYNC message with unsupported object type, expected 'counter' or 'map' to be present, skipping message; message id: ${objectMessage.id}, channel: ${this._channel.name}`,
59+
);
60+
continue;
61+
}
62+
5163
const objectId = objectState.objectId;
5264
const existingEntry = this._pool.get(objectId);
5365

@@ -75,14 +87,6 @@ export class SyncObjectsPool {
7587
this._mergeMapSyncState(existingEntry, objectMessage);
7688
continue;
7789
}
78-
79-
// RTO5f2c
80-
this._client.Logger.logAction(
81-
this._client.logger,
82-
this._client.Logger.LOG_MAJOR,
83-
'SyncObjectsPool.applyObjectSyncMessages()',
84-
`received OBJECT_SYNC message with unsupported object type, expected 'counter' or 'map' to be present, skipping message; message id: ${objectMessage.id}, channel: ${this._channel.name}`,
85-
);
8690
}
8791
}
8892

@@ -107,10 +111,8 @@ export class SyncObjectsPool {
107111
existingObjectState.map!.entries = {};
108112
}
109113

110-
if (newObjectState.map?.entries) {
111-
// RTO5f2a2 - during partial sync, no two messages contain the same map key,
112-
// so entries can be merged directly without conflict checking.
113-
Object.assign(existingObjectState.map!.entries, newObjectState.map.entries);
114-
}
114+
// RTO5f2a2 - during partial sync, no two messages contain the same map key,
115+
// so entries can be merged directly without conflict checking.
116+
Object.assign(existingObjectState.map!.entries, newObjectState.map!.entries);
115117
}
116118
}

0 commit comments

Comments
 (0)