Allow page queries and fragments to be shadowed by themes. #36917
Unanswered
laurenskling
asked this question in
Ideas / Feature Requests
Replies: 0 comments
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.
-
I'm heavily invested into themes. It helps me split code that I share between websites I build. If I create a new site that uses feature X and Y, just install the themes.
Now say, those themes are extending GraphQL data on my core schema. I can achieve this with the
createTypes
andcreateResolvers
functions. But adding these new fields into my GraphQL query are a different story..If I shadow a file that contains a pageQuery or a fragment, both will be included into the Gatsby ecosystem. Resulting in lots of warnings (#23729). Bypassing the pageQuery errors is possible, just give them seperate names. Fragments however, need to have a fixed name and the need to exist. So shadowing them is not possible (since the fragment name will be scraped twice and that will error/bug). And only including when needed is not possible, since the fragment needs to exist in both cases; with or without the theme.
If allowing me to shadow files with fragments in them, and this is handled correctly, I can shape my code so beautifully dynamic and pluggable. I could create a fallback fragment loading nothing much, and a shadow fragment that actually does the work. This would be my dream.
Beta Was this translation helpful? Give feedback.
All reactions