graphql-tag icon indicating copy to clipboard operation
graphql-tag copied to clipboard

Removing loc from gql return value

Open aucampia opened this issue 5 years ago • 0 comments

Currently loc is retained in the value returned from gql (return value of parseDocument) and this loc value is used in caching mechanism. One particular concern to me is that if the user deletes loc from the object returned by gql it may break the cache mechanism.

Would it not not be better to only retain it in objects stored in docCache and not in objects returned from gql? Maybe change return to be:

parsed = {...parsed}
return stripLoc(parsed, true)

The reason I raise this is because loc is ending up in jest snapshots in unit tests for a project I am working on. The jest snapshots are generated by enzyme (via enzyme-to-json).

aucampia avatar Jun 05 '19 06:06 aucampia