graphile / graphile/crystal

v5: polymorphic optimization opportunity

Open
#2,502 0 comments 0 reactions 0 assignees View on GitHub
✨ feature
Dominant language
TypeScript
Stars
12.9k
Forks
625
Avg merge
5h 23m
Merged PRs (30d)
24

Description

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

![Image](https://github.com/user-attachments/assets/a7062c82-64ab-46e6-8c4b-8679ad680dba)

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 `NPC`s such that only one call to `` is needed.

```graphql
{
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
}
}
}
}
}
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.