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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

} = data

const { hasNextPage, endCursor } = pageInfo || {}

// Sometimes private posts return as null.
// That causes problems for us so let's strip them out
nodes = nodes.filter(Boolean)
Expand Down