You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Create the following code
// MyComponent.tsimport{graphql}from'gql.tada';exportconstMyFragmentDocument=graphql(` fragment MyFragment on MyType { id }`);// MyView.tsimport{graphql}from'gql.tada';import{MyFragmentDocument}from'./MyComponent';exportconstMyQueryDocument=graphql.persisted('sha256:abc123',graphql(` query MyData { myType { ...MyFragment } } `,[MyFragmentDocument]),);
Run the graphqlsp code action on MyView.ts to insert the correct hash
Update the fragment - e.g. change id to myProp
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.
The text was updated successfully, but these errors were encountered:
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:
constFrag1Document=graphql(` fragment Frag1 on MyType { ...Frag2 }`)constFrag2Document=graphql(` fragment Frag2 on MyType { prop }`)constMyDocument=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.
The text was updated successfully, but these errors were encountered: