Mirror icon indicating copy to clipboard operation
Mirror copied to clipboard

breaking(SyncDictionary): Make data available to callback handler

Open MrGadget1024 opened this issue 2 years ago • 2 comments

  • OP_CLEAR will be called before the internal data is cleared, so users can iterate the items in the handler
  • OP_SET will give the old value in the item param instead of the new value. New value is already set in the dictionary.
  • OP_REMOVE will no longer send the value, just the key, because that's all we need.

BREAKING CHANGE: SyncDictionary - Make data available to callback handler

MrGadget1024 avatar Mar 24 '23 21:03 MrGadget1024

generally good to clear up the orders and confusion.

if we do this, might as well do it properly with:

  • .OnClear()
  • .OnSet()
  • etc.

this time? then old UNET API was always a little bit strange. would also be an obvious breaking change, instead of a silent breaking change

miwarnec avatar Mar 25 '23 08:03 miwarnec

What if we had a new type of SyncDictionary? Like AdvancedSyncDictionary or something? Avoid breaking existing projects, and give people something to use with cleaner functionality.

One thing I found while poking around the SyncDictionary code was that OP_ADD and OP_SET seemed redundant. Maybe just OP_CLEAR, OP_SET, and OP_REMOVE? Events could include OnClear, OnSet, and OnRemove.

I could draft up a PR if you're interested or have better things to do.

cshunsinger avatar Sep 19 '23 13:09 cshunsinger

Closing - work was merged in a series of PR's.

MrGadget1024 avatar Mar 23 '24 03:03 MrGadget1024