Related to #326, which addressed the special case of a document including a fragment which itself did not include any other fragments.
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 does not work when you have a query including a fragment which itself includes another fragment.
Steps to reproduce:
Create the following code
// FragmentA.ts
import { graphql } from 'gql.tada';
export const FragmentADocument = graphql(`
fragment FragmentA on MyType {
id
}
`);
// FragmentB.ts
import { graphql } from 'gql.tada';
import { FragmentADocument } from './FragmentA';
export const FragmentBDocument = graphql(`
fragment FragmentB on MyType {
...FragmentA
}
`, [FragmentADocument]);
// MyView.ts
import { graphql } from 'gql.tada';
import { FragmentBDocument } from './FragmentB';
export const MyQueryDocument = graphql.persisted(
'sha256:abc123',
graphql(`
query MyData {
myType {
...FragmentB
}
}
`, [FragmentBDocument]),
);
Run the graphqlsp code action on MyView.ts to insert the correct hash
Update FragmentA - 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.
Related to #326, which addressed the special case of a document including a fragment which itself did not include any other fragments.
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 does not work when you have a query including a fragment which itself includes another fragment.
Steps to reproduce:
Run the graphqlsp code action on
MyView.ts
to insert the correct hashUpdate
FragmentA
- e.g. changeid
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.