joebobmiles / zustand-middleware-yjs

Zustand middleware that enables sharing of state between clients via Yjs.
MIT License
103 stars 10 forks source link

Undefined Object in array will cause problem #42

Closed arvinxx closed 1 year ago

arvinxx commented 1 year ago

Here is the demo:

bug

the codesandbox: https://codesandbox.io/s/zustand-yjs-middleware-error-with-object-in-arrary-tmwfxz?file=/src/App.tsx

It casue when a object(arrary or object)set to undefined

joebobmiles commented 1 year ago

Wow, I can reproduce this everywhere but the Replay browser... Thankfully on Firefox, the error is a lot more verbose, and I know what check is failing.

joebobmiles commented 1 year ago

I can't reproduce the bug using the code for the latest version (1.3.0-rc.1) with tests. My fork of the CodeSandbox with the latest version also does not exhibit this behavior, so this is fixed by my rewrite of how changes are computed and applied in that version. I'll work on fixing the other issues so the new version is ready.