joebobmiles / zustand-middleware-yjs

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

[BUG] React components not updating after remote changes to nested array #63

Open twaddell opened 1 week ago

twaddell commented 1 week ago

Describe the bug When a remote client updates items in an object array the local client state is not updating "reactively" to the changes. It takes another trigger on the UI to see the updated state.

This appears to be due to patch updates to the array not being made in an immutable manner which zustand expects.

To Reproduce Steps to reproduce the behavior:

  1. Create a state with a object array
  2. On a remote client update a property on an object in the array
  3. On the local client the change is received and state is updated no UI changes occur.

Expected behavior The UI should update when remote updates to state are processed.

Versions (please complete the following information):