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

Should remove @client and __typename-only fragment and fragment spread if fragment appears before query #10539

Closed
alessbell opened this issue Feb 10, 2023 · 1 comment · Fixed by #10560
Assignees
Labels

Comments

@alessbell
Copy link
Member

alessbell commented Feb 10, 2023

Issue Description

For the following document node:

const query = gql`
  fragment toBeRemoved on Author {
    __typename
    isLoggedIn @client
  }

  query {
    author {
      name
      ...toBeRemoved
    }
  }
`

The expected document returned via removeClientSetsFromDocument(query) is

query {
  author {
    name
  }
}

instead of the current behavior:

query {
  author {
    name
    ...toBeRemoved
  }
}

which keeps a dangling reference to the removed fragment and will cause a server error.

Link to Reproduction

See code example

Reproduction Steps

No response

@alessbell alessbell changed the title bug: should remove @client and __typename-only fragment and fragment spread if fragment appears before query Should remove @client and __typename-only fragment and fragment spread if fragment appears before query Feb 10, 2023
@benjamn benjamn self-assigned this Feb 15, 2023
@github-actions
Copy link
Contributor

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
For general questions, we recommend using StackOverflow or our discord server.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants