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-wordpress): WPGraphQL pageInfo is nullable, make sure we're not accessing hasNextPage on null #32369

Merged
merged 1 commit into from
Jul 14, 2021

Conversation

TylerBarnes
Copy link
Contributor

This fixes an issue @graysonhicks was debugging.

WPGraphQL's pageInfo field is nullable, so we need to make sure we're not accessing hasNextPage on null.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Jul 14, 2021
@TylerBarnes TylerBarnes requested a review from graysonhicks July 14, 2021 19:19
@TylerBarnes TylerBarnes added topic: source-wordpress Related to Gatsby's integration with WordPress and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Jul 14, 2021
@TylerBarnes TylerBarnes requested a review from DanielSLew July 14, 2021 19:20
@@ -84,9 +84,11 @@ const paginatedWpNodeFetch = async ({
}

let {
[contentTypePlural]: { nodes, pageInfo: { hasNextPage, endCursor } = {} },
[contentTypePlural]: { nodes, pageInfo },
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these look almost the same. Where this is different is we never get to the = {} value fallback since null is a value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: merge on green Gatsbot will merge these PRs automatically when all tests passes topic: source-wordpress Related to Gatsby's integration with WordPress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants