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

check if o.hasOwnProperty is function #3418

Merged
merged 4 commits into from
May 24, 2018

Conversation

jorisroling
Copy link
Contributor

@jorisroling jorisroling commented May 7, 2018

Defence against the following error we have...

"stack": [
  "TypeError: o.hasOwnProperty is not a function",
  "    at /Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:9:9",
  "    at Array.forEach (<anonymous>)",
  "    at deepFreeze (/Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:7:33)",
  "    at /Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:14:7",
  "    at Array.forEach (<anonymous>)",
  "    at deepFreeze (/Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:7:33)",
  "    at Object.maybeDeepFreeze (/Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:29:14)",
  "    at /Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:593:31",
  "    at /Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1028:11",
  "    at Array.forEach (<anonymous>)",
  "    at /Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1027:10",
  "    at Map.forEach (<anonymous>)",
  "    at QueryManager.broadcastQueries (/Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1021:18)",
  "    at Object.next (/Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1094:18)",
  "    at notifySubscription (/Users/joris/CLIENT/PROJECT/node_modules/zen-observable/lib/Observable.js:126:18)",
  "    at onNotify (/Users/joris/CLIENT/PROJECT/node_modules/zen-observable/lib/Observable.js:161:3)"

Fixes #3426.

    "stack": [
      "TypeError: o.hasOwnProperty is not a function",
      "    at /Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:9:9",
      "    at Array.forEach (<anonymous>)",
      "    at deepFreeze (/Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:7:33)",
      "    at /Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:14:7",
      "    at Array.forEach (<anonymous>)",
      "    at deepFreeze (/Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:7:33)",
      "    at Object.maybeDeepFreeze (/Users/joris/CLIENT/PROJECT/node_modules/apollo-utilities/src/util/maybeDeepFreeze.ts:29:14)",
      "    at /Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:593:31",
      "    at /Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1028:11",
      "    at Array.forEach (<anonymous>)",
      "    at /Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1027:10",
      "    at Map.forEach (<anonymous>)",
      "    at QueryManager.broadcastQueries (/Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1021:18)",
      "    at Object.next (/Users/joris/CLIENT/PROJECT/node_modules/src/core/QueryManager.ts:1094:18)",
      "    at notifySubscription (/Users/joris/CLIENT/PROJECT/node_modules/zen-observable/lib/Observable.js:126:18)",
      "    at onNotify (/Users/joris/CLIENT/PROJECT/node_modules/zen-observable/lib/Observable.js:161:3)"
@apollo-cla
Copy link

@jorisroling: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Meteor Contributor Agreement here: https://contribute.meteor.com/

@apollo-cla
Copy link

apollo-cla commented May 7, 2018

Warnings
⚠️

There are library changes, but not tests. That's OK as long as you're refactoring existing code

Generated by 🚫 dangerJS

Copy link
Member

@hwillson hwillson left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this PR @jorisroling! I've adjusted things a little (switched to using Object.prototype.hasOwnProperty instead and added tests to make sure we don't regress in the future), but we should be all set here. LGTM!

@hwillson hwillson merged commit c258d69 into apollographql:master May 24, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants