-1

I've read this question which is more general: What is the point of naming queries and mutations in GraphQL?. The top answer indicates that Operation Name is meaningless, but a particular implementation can give it meaning.

My team lead and I are working refactoring some data into new static queries which might be repeated many times across the app. We think that naming the queries will allow Gatsby to cache the results, which would be great. But I can't actually find anything saying that in the Gatsby docs and now neither of us know where that idea came from. All I have found is this rather unhelpful description. So, does giving these queries names actually help us here, or is it pointless?

1 Answer 1

0

The operation name is irrelevant as Gatsby generates its own unique name internally (you can add it so that it makes it into that generation). If you e.g. create a custom hook with a useStaticQuery and then use that throughout your app, it'll only use that (so it's "cached").

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.