Skip to content

v5: polymorphic optimization opportunity #2502

Open
@jemgillam

Description

@jemgillam

ref: grafast/grafast/__tests__/dcc/queries/best-friends.test.graphql

Image

When querying through the same operation path, where one planning path crosses more polymorphic boundaries than another, the polymorphic fold-in system doesn't fire. In the diagram above, we should be able to recombine the ActiveCrawler path with the path used for NPCs such that only one call to <decodeItemSpect> is needed.

{
  character(id: 102) {
    id
    name
    ... on ActiveCrawler {
      bestFriend {
        __typename
        id
        name
        ... on HasInventory {
          items {
            __typename
            id
            name
          }
        }
      }
    }
    ... on NPC {
      bestFriend {
        __typename
        id
        name
        ... on HasInventory {
          items {
            __typename
            id
            name
          }
        }
      }
    }
  }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    🌳 Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions