question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Schema customization resolved data are not present in page component

See original GitHub issue

Description

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:

https://github.com/Simply007/gatsby-starter-kontent-lumen/blob/vNext/src/usedByContentItemsField.js#L27..L66

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:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Simply007commented, Aug 28, 2020

Applied fix and resolution works as expected:

Thanks, @vladar!

1reaction
vladarcommented, Aug 28, 2020

Published in gatsby@2.24.52

Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing the GraphQL Schema - Gatsby
Assume a new author joins the team, but in the new author entry there is a typo on the joinedAt field: “201-04-02” which...
Read more >
CUSTOM_ELEMENTS_SCHEMA added to NgModule ...
My Karma error was: If 'mat-panel-title' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule. schemas' of this component to suppress this ......
Read more >
How do I resolve issues with missing or incorrect schema ...
Resolution : recreate the environment using the proper SQL scripts generated by the BPM product during installation or DE creation.
Read more >
Component/Schema Configuration - Storyblok
Defines the default value of the field. Enables RTL, Boolean, If true, the field value will be shown from right to left in...
Read more >
Create Fields with Schema Builder - Salesforce Help
Formulas: How Do I ... ? Create Custom Home Page Components · Sync Data Between Salesforce and Heroku · Formula Field Limits and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found