Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

fix: Add OP_RENEW to SyncDictionary

Open Moddingdudes opened this issue 2 years ago • 3 comments

When all SyncDictionary values are set simultaneously, this treats the serialization/deserialization as "all" instead of "delta" which means Callback will not be invoked, so you will miss data changes from the host.

Moddingdudes avatar Sep 21 '23 02:09 Moddingdudes

interesting. @Moddingdudes any way we can reproduce the bug? then we can add a unit test if you let us know the initial issue

miwarnec avatar Sep 21 '23 09:09 miwarnec

Yes. Create a SyncDictionary with 2 keys and values. Add a callback to the SyncDictionary and have it log something. Iterate over all of the SyncDictionary keys and set their values to something new to trigger the Set overload of the SyncDictionary. The SyncDictionary seems to treat this as a new snapshot instead of a delta and calls OnDeserializeAll instead of OnDeserializeDelta, which means Callback is not fired. That's why I added an AddOperation function call in OnDeserializeAll with a new OP_RENEW addition to the Enum. In my testing, this worked well.

Moddingdudes avatar Sep 21 '23 09:09 Moddingdudes

thx will take a look soon ish!

miwarnec avatar Sep 27 '23 16:09 miwarnec