Skip to content

Fix infinite loop on invalid queries in OverlappingFields#1111

Merged
leebyron merged 1 commit intomasterfrom
fix-validation-recursion
Dec 4, 2017
Merged

Fix infinite loop on invalid queries in OverlappingFields#1111
leebyron merged 1 commit intomasterfrom
fix-validation-recursion

Conversation

@leebyron
Copy link
Copy Markdown
Contributor

@leebyron leebyron commented Dec 4, 2017

OverlappingFieldsCanBeMerged would infinite loop when passed something like

fragment A on User {
  name
  ...A
}

It's not OverlappingFieldsCanBeMerged's responsibility to detect that validation error, but we still would ideally avoid infinite looping.

This detects that case, and pretends that the infinite spread wasn't there for the purposes of this validation step.

Also, by memoizing and checking for self-references this removes duplicate reports.

Closes #780

`OverlappingFieldsCanBeMerged` would infinite loop when passed something like

```graphql
fragment A on User {
  name
  ...A
}
```

It's not `OverlappingFieldsCanBeMerged`'s responsibility to detect that validation error, but we still would ideally avoid infinite looping.

This detects that case, and pretends that the infinite spread wasn't there for the purposes of this validation step.

Also, by memoizing and checking for self-references this removes duplicate reports.

Closes #780
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants