At a glance
- Project
- GraphQL Spec
- Identifier
- #1045
- Stage
- RFC X / Rejected
- Champion
- @benjie
- Updated
- 2025-07-22
- Latest activity
- Pull request closed on
- Source
- Pull request
- Related RFCs
- FragmentArguments
Pull request description
@robrichard raised an issue for @defer whereby under the current draft specification if you have this query:
query HeroNameQuery {
hero {
...NameFragment
...NameFragment @defer
}
}
fragment NameFragment on Hero {
name
}
then the @defer will never be visited; but if you move the @defer earlier:
query HeroNameQuery {
hero {
...NameFragment @defer
...NameFragment
}
}
fragment NameFragment on Hero {
name
}
then the non-deferred version will never be visited.
@mjmahone has an RFC open about fragment arguments which suffers a similar issue: visits to a fragment aren't equivalent depending on the variables.
query HeroNameQuery {
hero {
...ComponentOne
...ComponentTwo
}
}
fragment ComponentOne on Hero {
id
...HeroDetails(includeBio: true, includeAvatar: false)
}
fragment ComponentTwo on Hero {
...HeroDetails(includeBio: false, includeAvatar: true)
}
fragment HeroDetails($includeBio: Boolean!, $includeAvatar: Boolean!) on Hero {
superheroName
realName
initials
... @include(if: $includeAvatar) {
avatarLarge
avatarSmall
}
... @include(if: $includeBio) {
bioTitle
bioSubtitle
bioEntryParagraph
bioQuote
bioMainText
}
}
Matt's solution takes a Relay-esque approach and generates a key for the fragments based on the values of their arguments.
Another consideration is where there are user-defined directives; e.g. { id ...Profile name ...Profile @live } might benefit from walking Profile again now that it has @live attached.
A simple solution to this is rather than each of these problems having their own solution, to simply navigate the fragment spread again - it's only a single layer that we need to worry about, so the cost is likely to be marginal. This RFC proposes this with a tiny change to the spec - after adding the fragmentSpreadName to visitedFragments, and calling CollectFields, we then remove it again.
Timeline
July 2025
- Pull request closed on
- Marked as Rejected on by benjie
- Discussed in GraphQL WG
The GraphQL Working Group meeting covered several key topics, including editorial changes to error propagation, fragment memoization, and service capabilities syntax. Discussions focused on improving schema coordinates, refining error handling mechanisms, and implementing a new system for representing service capabilities. The team debated various approaches to these issues, considering factors such as implementation complexity, backward compatibility, and potential future extensions.
Zoom summary · GraphQL WG · 2025-07-17Next StepsBenjie: Discuss with Yaakov about implementing schema coordinates as a map of String to Boolean for deferred status
Zoom summary · GraphQL WG · 2025-07-17The GraphQL Working Group meeting began with a round of introductions and a technical check of microphones and audio. Lee Byron announced the agenda, which included editorial changes on error propagation, removing fragment spread names from visited fragments, service capabilities syntax, and schema coordinates. The group agreed to prioritize schema coordinates due to their tight scope. Mark and Martin were set to lead discussions on their respective topics, but the transcript ended before they could begin.
Zoom summary · GraphQL WG · 2025-07-17GraphQL Fragment Memoization Strategy
Benjie and Leebyron discussed the handling of fragment memoization in GraphQL, focusing on the challenges of tracking visited fragments and the implications of removing this mechanism. They agreed on using a map to store fragment signatures with their respective colors (deferred or not) to handle potential conflicts and improve performance. Benjie planned to consult Yaakov about implementing this approach and ensuring compatibility with GraphQL.js. They also briefly touched on the topic of service capabilities, which Benjie mentioned would be discussed further in the composite schemas working group.
Zoom summary · GraphQL WG · 2025-07-17 - @benjie committed "Merge branch 'main' into rfc-visited-fragments" on
- On the agenda for GraphQL WG
8 listed attendees · 8 agenda items · 7 linked RFCs
- Editorial: Define 'execution' as in 'before execution begins' (10m, Benjie)
- RFC2: Schema coordinates (5m, Mark / Martin) #794
- RFC1: Fix CoerceArgumentValues() hasValue (10m, Benjie) #1056
- RFC1: List coercion algorithm (5m, Benjie) #1058
- RFC0: Incorporate meta-fields into ExecuteCollectedFields (10m, Benjie) #1177
- Defer/Stream updates (15m, Rob) DeferStream
- Discussion: Remove fragmentSpreadName from visitedFragments after visit (10m, Benjie) #1045
- Discussion: service capabilities syntax (10m, Benjie) #1163
September 2023
- Pull request created on by benjie
- @benjie committed "Remove fragmentSpreadName from visitedFragments when done" on
- Advanced to RFC 0 on by benjie