joebobmiles / zustand-middleware-yjs

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

Potential Fix for Issue #41 #47

Closed joebobmiles closed 1 year ago

joebobmiles commented 1 year ago

Managed to replicate #41 and have implemented a fix.

The issue was the direct modification of the Zustand state object via pass-by-reference. The solution was to clone the state object before submitting it to the patching function. Future improvement is to submit a partial object that contains only the changed/new data instead of submitting an entirely new state object.

joebobmiles commented 1 year ago

:tada: This PR is included in version 1.3.0-rc.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

joebobmiles commented 1 year ago

:tada: This PR is included in version 1.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: