fix(overlay): make sure root updates and array[0] updates work#685
Merged
paulRbr merged 3 commits intobump-sh:mainfrom Apr 1, 2025
Merged
fix(overlay): make sure root updates and array[0] updates work#685paulRbr merged 3 commits intobump-sh:mainfrom
paulRbr merged 3 commits intobump-sh:mainfrom
Conversation
While refactoring the overlay core in 2.9.3, we forgot to return the resulting object of the merge when the target overlay is the root object (`$`). Leading to an incorrect overlayed definition. The fix here is to return the definition object after an update.
This bug was introduced in the refactor of the overlay core lib of 2.9.3. Javascript default falsy values can be tricky (especially for `0` which is falsy). In the case of applying an overlay on an array, the first index (`0`) would never be modified due to this bug. We now compare the index to the literal `undefined` instead of checking its “falsyness”.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
These two cases (updating the root object, and, updating the first element of an array) was not tested in our unit tests and were both broken by the previous overlay core refactoring (#673). 🤯
Thanks a lot to @lcawl for reporting this issue 🙇
Closes https://github.com/bump-sh/bump/issues/6579