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

[CORL-1040] Story Update Fix #2939

Merged
merged 1 commit into from
Apr 17, 2020
Merged

[CORL-1040] Story Update Fix #2939

merged 1 commit into from
Apr 17, 2020

Conversation

wyattjoh
Copy link
Collaborator

What does this PR do?

It turns out, when some queries are formatted in a particular way, graphql will create javascript Object's with Object.create(null) (ref: graphql/graphql-js#504) even though this practice is discouraged (ref: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create).

This causes issues when you try to call prototype builtin's like hasOwnProperty on objects created this way.

This PR adjusts the linting rule for the no-prototype-builtins rule to prevent us from using these builtins to prevent this from causing issues in the future.

What changes to the GraphQL/Database Schema does this PR introduce?

None.

How do I test this PR?

Previously, the following GraphQL mutation would return an error:

mutation ($id: ID!, $url: String) {
  updateStory(input: {id: $id, story: {url: $url}, clientMutationId: ""}) {
    story {
      id
      url
    }
  }
}

Now, it does not. The is because the object created in {url: $url} is via Object.create(null). Now that we no longer use prototype builtin's, we don't encounter this bug.

@wyattjoh wyattjoh added the bug label Apr 17, 2020
@wyattjoh wyattjoh added this to the v6.2.0 milestone Apr 17, 2020
@wyattjoh wyattjoh merged commit 0e9621c into master Apr 17, 2020
@wyattjoh wyattjoh deleted the bugfix/CORL-1040 branch April 17, 2020 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants