zustand-middleware-yjs icon indicating copy to clipboard operation
zustand-middleware-yjs copied to clipboard

zustand-middleware-yjs not working with other zustand middlewares

Open hunterZh37 opened this issue 3 years ago • 1 comments

Hi, I have been trying to use multiple middleware in a single store (zustand-middleware-yjs being one of them). My implementation looks something like in the picture. Even though the data/state in the syncStore is changed, the zustand data/state living on my other device connecting to the same room("somethingRoom") is not updating.

Screen Shot 2022-05-05 at 9 13 00 AM Screen Shot 2022-05-05 at 9 16 44 AM

hunterZh37 avatar May 05 '22 14:05 hunterZh37

This is what I get for advertising compatibility with other middleware without actually testing it first. 😅

Have you tried composing the yjs middleware with only one middleware? For example, what happens when you compose yjs and immer, yjs and computed, or yjs and subscribeWithSelector? If you can test each of those cases, that can help me figure out if this is due to a compatibility issue with one of those middlewares or if yjs is breaking compatibility with all middlewares.

joebobmiles avatar May 05 '22 16:05 joebobmiles

Been a while, and after having returned to this, upgraded the v4 of Zustand, and written tests to try and capture what is happening here, I haven't been able to reproduce this.

If you can give me a reproduction case via CodeSandbox or a Git repository, I can take a deeper look into it. Otherwise, I'll close this issue due to inactivity.

joebobmiles avatar Nov 05 '22 03:11 joebobmiles

Closing this due to inactivity and inability to replicate the issue.

joebobmiles avatar Nov 11 '22 15:11 joebobmiles