-
Notifications
You must be signed in to change notification settings - Fork 884
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
utils/pick should catch falsy values #649
utils/pick should catch falsy values #649
Conversation
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.
Good catch, thanks!
src/utils/pick.js
Outdated
@@ -2,7 +2,7 @@ | |||
|
|||
export default function pick(object: Object, keys: Array<string>): Object { | |||
return keys.reduce((obj, key) => { | |||
if (object[key]) { | |||
if (object[key] !== undefined) { |
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.
Could you replace this by typeof object[key] !== 'undefined'
please?
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.
Sure thing, good suggestion! 88db6a5
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.
Thanks!
Thank you for being so responsive! We've already pulled the new release into production. |
When updating dynamic
Path
options, only truthy values are picked out of props to be updated. Path options can have valid falsy values, likefillOpacity: 0
orbubblingMouseEvents: false
. It is possible to initialize a dynamic property to a falsy value, but after changing it to a truthy one, it cannot be changed back. This PR changesutils/pick.js
so that it will pick any value that isn't=== undefined
.