Skip to content

v5: Unneeded branching while using query variables #2514

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

Open
jemgillam opened this issue May 27, 2025 · 0 comments
Open

v5: Unneeded branching while using query variables #2514

jemgillam opened this issue May 27, 2025 · 0 comments

Comments

@jemgillam
Copy link
Contributor

jemgillam commented May 27, 2025

Ref grafast/grafast/__tests__/dcc/queries/npc-friends.test.graphql

These two query plans are for the same query, but in the lower one we are using variables and unneeded branching is occurring.

query NpcFriends {
  npc(id: 301) {
    __typename
    id
    name

    exCrawler
    ... on Manager {
      friends(first: 2) {
        id
        name
      }
    }
    ... on Staff {
      friends(first: 2) {
        id
        name
      }
    }
  }
}

Image

But here, unneeded branching and combining is occurring after a lambda step:

query NpcFriendsWithVariables($first: Int) @variables(values: { first: 2 }) {
  npc(id: 301) {
    __typename
    id
    name

    exCrawler
    ... on Manager {
      friends(first: $first) {
        id
        name
      }
    }
    ... on Staff {
      friends(first: $first) {
        id
        name
      }
    }
  }
}

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🌳 Triage
Development

No branches or pull requests

1 participant