Mirror: TypeScript LSP plugin that finds GraphQL documents in your code and provides diagnostics, auto-complete and hover-information.
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

update cache key to include fragments with call expressions (#134)

authored by

Jovi De Croock and committed by
GitHub
cda0c9f2 8614a802

+13 -1
+5
.changeset/beige-worms-joke.md
··· 1 + --- 2 + '@0no-co/graphqlsp': patch 3 + --- 4 + 5 + Add fragments to the cache-key when using call-expressions
+8 -1
packages/graphqlsp/src/diagnostics.ts
··· 6 6 Kind, 7 7 OperationDefinitionNode, 8 8 parse, 9 + print, 9 10 } from 'graphql'; 10 11 import { LRUCache } from 'lru-cache'; 11 12 import fnv1a from '@sindresorhus/fnv1a'; ··· 75 76 }); 76 77 77 78 let tsDiagnostics: ts.Diagnostic[] = []; 78 - const cacheKey = fnv1a(texts.join('-') + schema.version); 79 + const cacheKey = fnv1a( 80 + isCallExpression 81 + ? texts.join('-') + 82 + fragments.map(x => print(x)).join('-') + 83 + schema.version 84 + : texts.join('-') + schema.version 85 + ); 79 86 if (cache.has(cacheKey)) { 80 87 tsDiagnostics = cache.get(cacheKey)!; 81 88 } else {