Closed felamaslen closed 1 month ago
I'd like to reopen this issue - the PR I merged fixed the inclusion of fragments one level deep, but this still does not work:
const Frag1Document = graphql(`
fragment Frag1 on MyType {
...Frag2
}
`)
const Frag2Document = graphql(`
fragment Frag2 on MyType {
prop
}
`)
const MyDocument = graphql(`
query My {
myType {
...Frag1
}
}
`);
The hash is of a document including MyDocument
and Frag1
, but not Frag2
.
When calling
graphql.persisted
, the hash needs to change whenever the query changes, so that you don't end up with conflicts between your remotely stored persisted operations and what you have defined in the client. This works for the most part, but doesn't seem to include fragments imported into the query.Steps to reproduce:
Run the graphqlsp code action on
MyView.ts
to insert the correct hashUpdate the fragment - e.g. change
id
tomyProp
Expected behaviour
There is a new hash suggested by graphqlsp through the code action, since the imported fragment changed, changing the content of the document.
Actual behaviour
There is no new hash suggested by graphqlsp, suggesting that the fragment is not taken into account.