-
Notifications
You must be signed in to change notification settings - Fork 2k
Non-Scalar default dangerous change: Fix for #1566 #1593
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
!isChangeSafeForDefaultValue(oldDefaultValue[key], newDefaultValue[key]) | ||
) { | ||
return false; | ||
} |
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.
@mjmahone According to current implementation adding properties to object is safe.
For example isChangeSafeForDefaultValue({}, {a: 1}) => true
or isChangeSafeForDefaultValue({a: undefined}, {a: 1}) => true
.
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 second this. Can we add a couple more testcases to make sure that check works correctly?
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.
That should be correct: adding a previously undefined value is OK, but removing a previously undefined value is not (recursively).
@mjmahone I think it's better to add |
This will not make it into 14.1 milestone: there's a little bit too much clean-up work required here. I'll try to fast-follow with a patch to get this included, but I don't want to hold up the 14.1 release on a bugfix. |
@helloqiu identified in #1566 that our dangerous changes check was incorrectly saying any non-scalar default value was a dangerous change, even if the default value hadn't actually changed. This is because we need to check the default value change for deep equality, rather than just whether the objects are identical.