Skip to content

fix graphql error#7557

Merged
leecalcote merged 3 commits intolayer5io:masterfrom
saurabhraghuvanshii:test
Mar 26, 2026
Merged

fix graphql error#7557
leecalcote merged 3 commits intolayer5io:masterfrom
saurabhraghuvanshii:test

Conversation

@saurabhraghuvanshii
Copy link
Copy Markdown
Member

@saurabhraghuvanshii saurabhraghuvanshii commented Mar 25, 2026

Description

  • Gatsby builds GraphQL input types (like MdxFieldsSortInput) from fields it sees during schema inference.

  • In lightweight build profile, blog nodes are excluded.

  • If dateForSort is only created for blog nodes, Gatsby never sees that field in this build.

  • Then any query that says sort: { fields: { dateForSort: DESC } } fails at compile time with: Field "dateForSort" is not defined by type "MdxFieldsSortInput".

This PR fixes #7556

Notes for Reviewers

Signed commits

  • Yes, I signed my commits.

Signed-off-by: saurabhraghuvanshii <saurabhsraghuvanshi@gmail.com>
Comment thread gatsby-node.js
});

// Normalize blog date to ISO string for stable sort order across build environments (fixes production blog order)
if (collection === "blog") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not just removing this condition? Why does the rest of the script need to change? You have not offered any description justifying the change.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I didn’t change the script—only removed the condition. The rest are lint-related changes after removing that condition.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We keep running into this. Stop your linter from making all these changes.

@l5io
Copy link
Copy Markdown
Member

l5io commented Mar 25, 2026

🚀 Preview for commit c2418af at: https://69c451c0e951a4b02b933838--layer5.netlify.app

@l5io
Copy link
Copy Markdown
Member

l5io commented Mar 25, 2026

🚀 Preview for commit b169207 at: https://69c45b01177babc5f652cb59--layer5.netlify.app

@leecalcote leecalcote merged commit 129fb81 into layer5io:master Mar 26, 2026
4 checks passed
@saurabhraghuvanshii saurabhraghuvanshii deleted the test branch March 26, 2026 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix Graphql build error

3 participants