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.

prevent dupes (#100)

authored by

Jovi De Croock and committed by
GitHub
479fe2b1 277ca619

+11 -1
+5
.changeset/popular-bikes-clap.md
··· 1 + --- 2 + '@0no-co/graphqlsp': patch 3 + --- 4 + 5 + Prevent duplicate async file-generation processes from happening
+6 -1
packages/graphqlsp/src/diagnostics.ts
··· 33 33 export const MISSING_FRAGMENT_CODE = 52003; 34 34 export const USING_DEPRECATED_FIELD_CODE = 52004; 35 35 36 + let isGeneratingTypes = false; 37 + 36 38 export function getGraphQLDiagnostics( 37 39 // This is so that we don't change offsets when there are 38 40 // TypeScript errors ··· 308 310 !disableTypegen 309 311 ) { 310 312 try { 311 - if (isFileDirty(filename, source)) { 313 + if (isFileDirty(filename, source) && !isGeneratingTypes) { 312 314 return tsDiagnostics; 313 315 } 316 + isGeneratingTypes = true; 314 317 315 318 const parts = source.fileName.split('/'); 316 319 const name = parts[parts.length - 1]; ··· 421 424 info.languageServiceHost.writeFile!(source.fileName, finalSourceText); 422 425 scriptInfo!.reloadFromFile(); 423 426 scriptInfo!.registerFileUpdate(); 427 + isGeneratingTypes = false; 424 428 }); 425 429 } catch (e) { 426 430 const scriptInfo = info.project.projectService.getScriptInfo(filename); 427 431 scriptInfo!.reloadFromFile(); 432 + isGeneratingTypes = false; 428 433 } 429 434 } 430 435