Schema customization resolved data are not present in page component
See original GitHub issueDescription
I have a site using schema customization for extending the types:
My use case is that I want a backreference from kontent_item_category
to kontent_item_article
to be able to show how many articles are in the category.
Steps to reproduce
If you check Gatsby preview on site: https://gatsby-starter-kontent-lumen-8311752784.gtsb.io/categories
The result returns (N/A means the data in backreference are not present):
design-inspiration (N/A)
gatsby (N/A)
typography (N/A)
But if you try to run the query on the same environment vie GraphiQL
query MyQuery {
allKontentItemCategory(filter: {preferred_language: {eq: "en-US"}}) {
nodes {
elements {
title {
value
}
}
used_by_articles {
system {
codename
}
}
}
}
}
Implementation
I am using createSchemaCustomization
hook in gatsby-node.js https://github.com/Simply007/gatsby-starter-kontent-lumen/blob/vNext/gatsby-node.js#L10 to extend the kontent_item_category
type.
The implementation of schema customization is here:
Expected result
I would expect to have the same result in the page data as in GraphiQL.
Actual result
used_by_articles
is null
in the categories https://github.com/Simply007/gatsby-starter-kontent-lumen/blob/vNext/src/pages/categories.jsx#L35 page.
Environment
The same problem is on my local machine:
gatsby info --clipboard
System: OS: Windows 10 10.0.18363 CPU: (8) x64 Intel® Core™ i5-8350U CPU @ 1.70GHz Binaries: Node: 12.13.0 - C:\Program Files\nodejs\node.EXE Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 6.12.0 - C:\Program Files\nodejs\npm.CMD Languages: Python: 2.7.17 Browsers: Edge: 44.18362.449.0 npmPackages: gatsby: ^2.20.36 => 2.20.36 gatsby-cli: ^2.11.22 => 2.11.22 gatsby-plugin-catch-links: ^2.0.4 => 2.2.1 gatsby-plugin-google-analytics: ^2.0.6 => 2.2.2 gatsby-plugin-google-fonts: latest => 1.0.1 gatsby-plugin-react-helmet: ^3.0.0 => 3.2.1 gatsby-plugin-sass: ^2.0.1 => 2.2.1 gatsby-plugin-sharp: ^2.5.3 => 2.5.3 gatsby-plugin-sitemap: ^2.0.1 => 2.3.1
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
Applied fix and resolution works as expected:
Thanks, @vladar!
Published in
gatsby@2.24.52