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 error in collectTypes method #343

Merged
merged 1 commit into from
Jul 17, 2019
Merged

Conversation

mxstbr
Copy link
Contributor

@mxstbr mxstbr commented Jul 16, 2019

obj.hasOwnProperty can sometimes be undefined even though obj is an actual object, see this conversation over in another repo for reference: domchristie/humps#35

I am (somehow through a million hoops) running into this in my project, and their suggested fix of using Object.prototype.hasOwnProperty.call(obj, key) works beautifully and fixes my issue.

`obj.hasOwnProperty` can sometimes be undefined even though `obj` is an actual object, see this conversation over in another repo for reference: domchristie/humps#35

I am (somehow through a million hoops) running into this in my project, and their suggested fix of using `Object.prototype.hasOwnProperty.call(obj, key)` works beautifully and fixes my issue.
Copy link
Collaborator

@JoviDeCroock JoviDeCroock 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, nice find!

@mxstbr
Copy link
Contributor Author

mxstbr commented Jul 16, 2019

Any chance somebody could cut a release? 🙏

@kitten
Copy link
Member

kitten commented Jul 16, 2019

cc @andyrichardson

@mxstbr
Copy link
Contributor Author

mxstbr commented Jul 17, 2019

Friendly ping we are blocked by this right now 😊

@andyrichardson
Copy link
Contributor

Makes sense and looks good to me!

I suspect we had this conditional for TS reasons rather than runtime execution? Can't reproduce type errors on my end without the conditional so maybe this has been addressed in later updates. Either way, let's get this merged and look into that later 👍

@andyrichardson andyrichardson merged commit 54e5641 into urql-graphql:master Jul 17, 2019
@mxstbr mxstbr deleted the patch-1 branch July 17, 2019 11:09
@mxstbr
Copy link
Contributor Author

mxstbr commented Jul 17, 2019

Thank you @andyrichardson! A release would be great 🙏

@andyrichardson
Copy link
Contributor

@mxstbr I'll aim to get a release out tonight!

jaredpalmer pushed a commit to jaredpalmer/formik that referenced this pull request Jan 7, 2020
Closes #2138

From time to time, Formik may be passed Object-like
data that does not inherit from the Object prototype.
In these cases, hasOwnProperty is not defined, and
prepareDataForValidation will throw.

The fix is to use Object.prototype to call
hasOwnProperty on the data.

See urql-graphql/urql#343
passionSeven added a commit to passionSeven/formik that referenced this pull request Oct 17, 2022
Closes #2138

From time to time, Formik may be passed Object-like
data that does not inherit from the Object prototype.
In these cases, hasOwnProperty is not defined, and
prepareDataForValidation will throw.

The fix is to use Object.prototype to call
hasOwnProperty on the data.

See urql-graphql/urql#343
Brwonbear9241 pushed a commit to Brwonbear9241/formilk that referenced this pull request May 5, 2023
Closes #2138

From time to time, Formik may be passed Object-like
data that does not inherit from the Object prototype.
In these cases, hasOwnProperty is not defined, and
prepareDataForValidation will throw.

The fix is to use Object.prototype to call
hasOwnProperty on the data.

See urql-graphql/urql#343
seniordev0312 added a commit to seniordev0312/react-form that referenced this pull request May 14, 2023
Closes #2138

From time to time, Formik may be passed Object-like
data that does not inherit from the Object prototype.
In these cases, hasOwnProperty is not defined, and
prepareDataForValidation will throw.

The fix is to use Object.prototype to call
hasOwnProperty on the data.

See urql-graphql/urql#343
kstar0707 added a commit to kstar0707/formik that referenced this pull request Nov 29, 2023
Closes #2138

From time to time, Formik may be passed Object-like
data that does not inherit from the Object prototype.
In these cases, hasOwnProperty is not defined, and
prepareDataForValidation will throw.

The fix is to use Object.prototype to call
hasOwnProperty on the data.

See urql-graphql/urql#343
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.

4 participants