-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enhanceReducer can not be used with more than 1 slice #9
Comments
Hey, thanks for taking the time, but as it stands I don't feel comfortable merging the PR. There are two main reasons:
Regardless, I'd much rather move to a more generic and flexible way of interacting with the Redux store, which would require the user to supply a getter and setter for said store. At which point, this library is actually not far from being completely Redux agnostic. If you feel comfortable, I'd be happy to help you out with implementing that :) |
Thanks for the fast response and your explanations :) Yes, I like the idea of adding the slice name to the action. I can try to implement that… Your suggestion of using getters and setters instead of slices sounds interesting too 👍 |
@lscheibel Are you aware of https://github.com/SebastianStehle/yjs-redux ? …I'm still willing to contribute. Just didn't find the time till now… During the last months I have been happy using this modification: https://github.com/FormsWizard/processing/blob/main/packages/react-redux-yjs/features/enhanceReducer.ts |
First of all, thanks a lot for this nice library, I very appreciate it :)
Till now it is not supported, that more than one slice of the same store can be synchronized.
If one tries do do so,
enhanceReducer
is called withaction.type === SET_STATE_FROM_YJS_ACTION
for each reducer.The current implementation of enhanceReducer causes the state of slices that should not be affected to be overwritten with
action.payload
.A solution would be substituting this line of code with a merge of the existing state with the update received from yjs. I will provide a Pull Request doing this…
The text was updated successfully, but these errors were encountered: