Skip to content

Commit

Permalink
Extract fragment definitions from the root-document (#360)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoviDeCroock authored Oct 3, 2024
1 parent 0570a06 commit 9288949
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/silent-spiders-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@0no-co/graphqlsp': patch
---

Extract inlined fragments for the non-tada route
5 changes: 4 additions & 1 deletion packages/graphqlsp/src/persisted.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export const generateHashForDocument = (
const deduplicatedFragments = fragments
.map(fragment => {
stripUnmaskDirectivesFromDefinition(fragment);
return print(fragment)
return print(fragment);
})
.filter((fragment, index, array) => array.indexOf(fragment) === index);

Expand Down Expand Up @@ -230,6 +230,9 @@ export const generateHashForDocument = (

const spreads = new Set<string>();
visit(parsed, {
FragmentDefinition: node => {
fragments.push(node);
},
FragmentSpread: node => {
spreads.add(node.name.value);
},
Expand Down

0 comments on commit 9288949

Please sign in to comment.