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

utils/pick should catch falsy values #649

Merged
merged 4 commits into from
Dec 14, 2019

Conversation

CaptainLexington
Copy link
Contributor

@CaptainLexington CaptainLexington commented Dec 12, 2019

When updating dynamic Path options, only truthy values are picked out of props to be updated. Path options can have valid falsy values, like fillOpacity: 0 or bubblingMouseEvents: 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 changes utils/pick.js so that it will pick any value that isn't === undefined.

Copy link
Owner

@PaulLeCam PaulLeCam left a comment

Choose a reason for hiding this comment

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

Good catch, thanks!

@@ -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) {
Copy link
Owner

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?

Copy link
Contributor Author

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

Copy link
Owner

@PaulLeCam PaulLeCam left a comment

Choose a reason for hiding this comment

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

Thanks!

@PaulLeCam PaulLeCam merged commit 11b1df8 into PaulLeCam:master Dec 14, 2019
@CaptainLexington
Copy link
Contributor Author

Thank you for being so responsive! We've already pulled the new release into production.

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.

None yet

2 participants