Closed rubenen closed 2 years ago
Nice catch.
That's something not covered in tests.
I wish it to work (if we just need to yarray.delete
and yarray.insert
), so this can be said a bug.
I will look into it, when I get time. Feel free to play around the internals if you are interested.
Added some failing tests in #8.
Published: https://www.npmjs.com/package/valtio-yjs/v/0.1.7
Sorry for taking so much time.
Amazing project this one!
I have some issues moving items in an array though - in plain valtio I can move an element like this:
This breaks if I activate the yjs binding (uncomment https://codesandbox.io/s/valtio-yjs-array-demo-forked-j1djs?file=/src/App.js:353-388).
I think I can make it work using the
Y.array
methods directly (firstyarray.delete(index)
and thenyarray.insert(newIndex, [item])
).I'm not sure if this is a bug or just a limitation since js arrays don't have delete and insert methods.