Value in making ACTUALLY reusable graphql fragments #38867
Unanswered
kylewinkler
asked this question in
Ideas / Feature Requests
Replies: 1 comment
-
Hi Kyle, You can create a file, for exemple import { graphql } from "gatsby";
export const myFragment = graphql`
fragment myFragment on MyItem {
myField
}
}
`; and the fragment will be automatically loaded (so import is not needed !) and accessible to all graphql queries. Arthur. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
So, the ability to create fragments for specific queries is nice for organization but it hardly when I have multiple endpoints, and the same object exists on all of them, it feels really bad to have to make a new fragment with the exact same code for each endpoint.
I love having to update 5 different duplicated code snippets when I want to add a single field to an object lol.
Is there any intention to create an actually reusable fragment capability here?
Beta Was this translation helpful? Give feedback.
All reactions