Optimize Gatsby GraphQL queries to avoid N+1 issues#898
Optimize Gatsby GraphQL queries to avoid N+1 issues#898Nesar976 wants to merge 3 commits intocilium:mainfrom
Conversation
Signed-off-by: Nesar976 <[email protected]>
✅ Deploy Preview for cilium ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR targets Gatsby build-time performance by reducing repeated GraphQL calls in gatsby-node.js and pushing some filtering into GraphQL to avoid N+1 query patterns during page creation (Fixes #893).
Changes:
- Move draft filtering for blog post creation into the GraphQL query via a
$draftFiltervariable. - Replace per-category GraphQL queries for blog category pages with a single
allPostsquery and in-memory filtering. - Replace per-category/per-page GraphQL queries for labs pages with a single
allLabsquery and in-memory filtering + slicing for pagination.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Nesar976 <[email protected]>
|
Hi @xmulligan , Addressed all review comments and updated the branch.Added GraphQL error handling and pagination safety as suggested . Let me know if anything else is needed. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi @xmulligan, Removed the hardcoded limits and added null-safe category filtering. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ring Signed-off-by: Nesar976 <[email protected]>
f19cba1 to
e6984b6
Compare
|
Hi @xmulligan, |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (result.errors) { | ||
| reporter.panicOnBuild('GraphQL query failed', result.errors[0]); |
This PR improves build-time performance by moving filtering logic into the GraphQL queries and removing N+1 query patterns in gatsby-node.js.
The behavior and output remain unchanged; this is purely a performance and maintainability improvement.
Fixes #893