-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add configurable merge strategies #5
Comments
Just noting that this and That being said, we could expose some of these functions if users want to use elsewhere in their code I guess, but they should all be pretty simple. Another note is that this is related to implementing Transforms. We could just not have merge strategies built-in and leave them up to the user to implement as transforms. If we do have merge strategies built-in, then the order between them and transforms needs to be defined (and merge strategies should probably just be implemented as a transform). |
Since I don't really understand most of what you're talking about, but can mostly assume it's to do with how to persist selected parts of our tree: Assume you're making a game, where you have something roughly like
Some of this I want to persist, some of it i want to come from initial data:
Suggestions on how to do this without:
|
@airtonix sorry for the delayed response
Sorry that's not correct. This issue is about how to merge persisted data with data created during
This is a fairly complex model -- minimal examples are much more helpful and significantly easier to respond to. I saw this when you commented, but given the complexity here, I did not really have the time to respond. I also did not see your edits until now
You might be looking for #27, but I can see that this would be useful for the initial data portion as well.
|
Per my comments in #1 (comment), should support something like
redux-persist
's State Reconcilers as merge strategies. This is basically just to handle state created in.create(...)
, unlesspersist
is called after some actions have been performed (which wouldn't be the standard usage, but is possible 🤷♂).applySnapshot
is equivalent tohardSet
but with the model's defaults added. Users should be able to configure if they want a different merge strategy like a shallow merge (autoMergeLevel1
).The text was updated successfully, but these errors were encountered: