-
Notifications
You must be signed in to change notification settings - Fork 138
fix(utils): deepMixIn to properly merge undefined values of source #502
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #502 +/- ##
==========================================
+ Coverage 95.83% 95.84% +<.01%
==========================================
Files 21 21
Lines 2524 2525 +1
==========================================
+ Hits 2419 2420 +1
Misses 105 105
Continue to review full report at Codecov.
|
this new behavior should be somehow optional in some cases it can be required to remove properties that don't exist anymore - e.g. some prop was removed from the object and we receive updated object from the network also a lot of code could have already rely on this behavior, so changing it may break it |
isn't |
@zuzusik I think you might be right - this could cause potential breaking behavior in existing implementations. I'll look at possibly making this an option with some flag. If you have any ideas, throw them out. |
@ivanvoznyakovsky |
@crobinson42 I should have missed it. then we should definitely think of making it optional. |
After looking at at example a little further and taking into consideration @zuzusik comment about this breaking existing implementations - the code snippet in the issue doesn't correctly depict the behavior, @ivanvoznyakovsky - the key still exists but is overwritten with the value |
@ivanvoznyakovsky here is an example of the existing behavior without this PR: https://runkit.com/crobinson42/github-com-js-data-js-data-issues-501 |
actual problem is how record object is created from api response based on record schema. {
schema: {
properties: {
uid: {type: 'string'},
name: {type: 'string'},
comment: {type: 'string', 'null'}
}
}
}
|
as @zuzusik said we could potentially make skipping |
@ivanvoznyakovsky I understand your situation - thanks for outlining that. I don't disagree with making a flag to skip |
thoughts on creating a new merge strategy |
I think the problem is in the way the schema is applied - perhaps we should look at a different angle of solving this. I don't think the situation you described above where a query is made without explicitly defining a key, then that key shouldn't be in the source object to be merged, ie: if |
Fixes #501
npm test
succeeds