SyncedStore icon indicating copy to clipboard operation
SyncedStore copied to clipboard

[Q] how should I map internal objects to SyncedStore proxies?

Open rozek opened this issue 1 year ago • 0 comments

Hi!

I'm currently evaluating "SyncedStore", but ran into a problem:

  • my items to share are class instances or lists (i.e., arrays) or them
  • however, adding objects to a "SyncedStore" constructs Y.Map/Arrays and then proxies them
  • as a consequence, the "target" property of any change reported by "observeDeep" returns something completely different from the proxy or my original object

As I would like to register a single change event handler (i.e., a toplevel "observeDeep") and access the changed object directly, the question arises how I can determine which of my original objects maps to a given change.target

I already tried to use the UUID of my original object, but setting a property on an array raises an exception in "array.ts":

array.ts:173 Uncaught Error
    at Object.set (array.ts:173:15)
    at VM30368 about:srcdoc:11:48

rozek avatar Jun 25 '24 05:06 rozek