Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gatsby-source-contentful): don't apply parent node links to child nodes #38728

Merged
merged 2 commits into from
Dec 1, 2023

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Dec 1, 2023

Description

In some cases delta data update for contentful would result in bad child nodes being created/updated. This later result in warning like this:

warning Multiple node fields resolve to the same GraphQL field `contentfulTitleBodyVideoBodyTextNode.body` - [`body`, `body___NODE`]. Gatsby will use `body___NODE`.

and eventually in crash with following error:

Field "body" of type "contentfulTitleBodyVideoBodyTextNode" must have a selection of subfields. Did you mean "body { ... }"?

This happens because when handling backreferences in delta data updates plugin currently applies __NODE fields of parent node to child nodes which is wrong.

First commit adds currently failing unit test case for this scenario. Second commit (yet to be pushed) will fix the issue.

Tests

Test case was added to unit tests

Related Issues

FRA-117

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 1, 2023
@pieh pieh added topic: source-contentful Related to Gatsby's integration with Contentful and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Dec 1, 2023
@pieh pieh marked this pull request as ready for review December 1, 2023 10:35
Copy link
Contributor

@TylerBarnes TylerBarnes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! 🚀

@pieh pieh merged commit be36b4a into master Dec 1, 2023
33 checks passed
@pieh pieh deleted the fix/contentful-delta-child-backrefs branch December 1, 2023 16:43
pieh added a commit that referenced this pull request Dec 1, 2023
… nodes (#38728)

* test: add test case asserting child nodes don't 'inherit' parent's links

* fix(gatsby-source-contentful): don't apply parent node links to child nodes

(cherry picked from commit be36b4a)
pieh added a commit that referenced this pull request Dec 4, 2023
… nodes (#38728) (#38730)

* test: add test case asserting child nodes don't 'inherit' parent's links

* fix(gatsby-source-contentful): don't apply parent node links to child nodes

(cherry picked from commit be36b4a)

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
@pieh
Copy link
Contributor Author

pieh commented Dec 4, 2023

Released in gatsby-source-contentful@8.12.5

This was referenced Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: source-contentful Related to Gatsby's integration with Contentful
Projects
Status: Published
Development

Successfully merging this pull request may close these issues.

2 participants