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

Infinite loop in TransformCompositeFields when using WrapFields #4774

Open
1 of 4 tasks
Tracked by #5201 ...
srolel opened this issue Oct 24, 2022 · 0 comments
Open
1 of 4 tasks
Tracked by #5201 ...

Infinite loop in TransformCompositeFields when using WrapFields #4774

srolel opened this issue Oct 24, 2022 · 0 comments

Comments

@srolel
Copy link

srolel commented Oct 24, 2022

Issue workflow progress

Progress of the issue based on the Contributor Workflow

  • 1. The issue provides a reproduction available on Github, Stackblitz or CodeSandbox

    Make sure to fork this template and run yarn generate in the terminal.

    Please make sure the GraphQL Tools package versions under package.json matches yours.

  • 2. A failing test has been provided
  • 3. A local solution has been provided (commit)
  • 4. A pull request is pending review

Describe the bug

When using WrapFields a larger number of times across multiple handlers, a graphql.visit invocation gets increasingly slower. I observed that the selection set in the visited document increases in powers of two for some reason. I'm not sure exactly why but after debugging it is a result of this bit in TransformCompositeFields.

To Reproduce
My implementation is complex (and the issue seems to be a result of that complexity) but because the fix seems harmless I thought I'd report it before trying to reproduce in a minimal example.

Expected behavior

The visit function is not stuck in a loop.

Environment:

  • OS:
  • @graphql-tools/...:
  • NodeJS: 16

Additional context

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

No branches or pull requests

1 participant