@client directive breaks fragments
See original GitHub issueIntended outcome: Trying to use a fragment in a query with @client directive
export const GET_APPS = gql`
fragment AppFragment on App {
id
name
}
query GetApps {
apps @client {
...AppFragment
# id
# name
}
}
`
Returns the apps with their id
and name
fields(it works if i uncomment the two fields)
Actual outcome: The apps are returned with no fields at all
How to reproduce the issue:
I’m just using a TypePolicies Query that returns an array of object with the id
and name
fields
Versions
"@apollo/client": "^3.0.0-beta.43"
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Fragments - Apollo GraphQL Docs
A GraphQL fragment is a piece of logic that can be shared between multiple queries and mutations. Every fragment includes a subset of...
Read more >Can I define fragments on either the client or the server? - Reddit
It seems like I define fragments on either the client (using functions like gql or graphql ) or on the server (using functions...
Read more >Fragment composition with Apollo client: convention and ...
I'd like to know better how to compose GraphQL fragments with Apollo client. I know how to do it, but I'd like to...
Read more >Using fragments | Vue Apollo
The most straightforward use of fragments is to reuse parts of queries (or mutations or subscriptions) in various parts of your application. For...
Read more >A deep-dive into Relay, the friendly & opinionated GraphQL ...
Go with a less opinionated, more flexible GraphQL client like Apollo. Anatomy of Relay. Colocation. Fragments; Data masking. Relay compiler.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Banou26 thanks for updating your reproduction. This isn’t a bug though. You aren’t providing enough information in your
read
function to resolve the fragment properly. Your fragment is on the typeFoo
, but you aren’t referencingFoo
when you return data from thefoo
read function. Update your code with the following, and it will work:Still an issue under
^3.3.16
which is current latestRepro here with the code example i gave: https://github.com/Banou26/apollo-client-bug-6175