YousefED / SyncedStore

SyncedStore CRDT is an easy-to-use library for building live, collaborative applications that sync automatically.
https://syncedstore.org
MIT License
1.69k stars 51 forks source link

Moving an item between arrays gives error about content already being a part of the tree #125

Open davisg123 opened 5 months ago

davisg123 commented 5 months ago

I hit an issue where moving an item to a new array is throwing an error

const item = store.arr1.splice(0, 1)[0]
store.arr2.push(item)  // throws error item is already part of tree

If we set the data and not the proxy it works, is that the expected way to set items on arrays?

const item = store.arr1.splice(0, 1)[0]
store.arr2.push(deepClone(item))  // works