Closed NeuralMayu closed 1 year ago
Hey @NeuralMayu, could you expand a bit on what you're looking for? I'm afraid I'm not understanding the ask here.
That parseDocument
function parses the GraphQL string into an AST and adds some light validation. The internal cache can really help speed up processing time since 2 equivalent GraphQL strings should parse the same way.
It's not clear to me what data you're looking for here since this just parses a GraphQL strin and no data is involved. Could you provide more info?
function parseDocument(source: string) { var cacheKey = normalize(source); if (!docCache.has(cacheKey)) { const parsed = parse(source, { experimentalFragmentVariables, allowLegacyFragmentVariables: experimentalFragmentVariables, } as any); if (!parsed || parsed.kind !== 'Document') { throw new Error('Not a valid GraphQL document.'); } docCache.set( cacheKey, // check that all "new" fragments inside the documents are consistent with // existing fragments of the same name stripLoc(processFragments(parsed)), ); } return docCache.get(cacheKey)!; }
The above is a fragment from the source code,But my needs are like cacheKey, and the subsequent data changes, so I don't want to use this cache, okay?