Skip to content
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

Fix: array comparison breaks if using the environments plugin #682

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

torgst
Copy link
Contributor

@torgst torgst commented Sep 14, 2024

I believe this will solve what I think is a serious bug introduced in version 2.1.11 as reported in issue 108.

If I understand things correctly, loading the environment plugin removes the name value from the MergeDeep.NAME_FIELDS array and this again breaks merging arrays, thus leading to diff reporting not working as expected.

I believe this change keeps the result of the fix that caused the bug, but in a way that removes the problem.

I also did a quick change at the end of mergeDeep.js where this line was duplicated (I believe that must be just a slip):

MergeDeep.NAME_FIELDS = NAME_FIELDS
MergeDeep.NAME_FIELDS = NAME_FIELDS
module.exports = MergeDeep

I found the logic behind some of what happened here hard to follow and updated the comments to try to make it easier to follow.
The environments plugin was changing `MergeDeep.NAME_FIELDS`, which is a global object. The reason was to avoid environments being filtered out from the change list if they only have a name field.
However, the environments plugin has it's own overriden sync method, and thus we can simply drop the whole filtering from that method.

Fixes github#108
This has to be a "typo" from 9a74e05 calling the same assignment twice. Removing to clean up.
Copy link
Collaborator

@decyjphr decyjphr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@decyjphr decyjphr merged commit 85aae4f into github:main-enterprise Sep 16, 2024
5 of 6 checks passed
@torgst torgst deleted the name_fields branch October 6, 2024 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants