Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Don't generate patch for a no-change set operation #45
Don't generate patch for a no-change set operation #45
Changes from all commits
7c29a20
32ee4cf
236f2cf
681d9e4
0920809
d1216b8
0257a92
86753dc
21af2ec
e81f6a4
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this function (and tests) need to be extended cover scenario of adding a
null
beyond the end of the array:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tomalec Good catch! I noticed that these cases are were not dealt with properly and had intended to file a separate issue about it. The thing is that adding
undefined
elements is broken onmaster
as well and therefore i figured it was a bit out of scope for this PR.Check out failing test on 7cf32fd which is based on current
master
. Here theundefined
element results in areplace
patch when it should be anadd
. Based on this PR, the same test also fails, although differently: 5de895f. Here theundefined
element is simply ignored. Note that both fail on elements which are added implicitly without ever being set such asarr[5]
andarr[6]
in the example which are not present in the patch at all.The test is based on your example with an addition:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #52.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We found another issue with this function. Is it called when you
pop
an array?Then change from
undefined
(mapped tonull
) to not existing element.I guess it should call
deleteTrap
but it's worth to add a test for such case as well.