Skip to content

feat(sistent): refactor pagination to use dynamic GraphQL routing and remove content.js#7587

Open
rishiraj38 wants to merge 6 commits intolayer5io:masterfrom
rishiraj38:feat/sistent-dynamic-pagination
Open

feat(sistent): refactor pagination to use dynamic GraphQL routing and remove content.js#7587
rishiraj38 wants to merge 6 commits intolayer5io:masterfrom
rishiraj38:feat/sistent-dynamic-pagination

Conversation

@rishiraj38
Copy link
Copy Markdown
Member

Description

This PR fixes #7585 by replacing the hardcoded content.js array with a dynamic GraphQL useStaticQuery to automatically handle Sistent pagination.

This ensures that any newly added component or tab (overview, guidance, code) is instantly indexed and correctly ordered in the pagination workflow without requiring developers to manually update boilerplate arrays.

Changes Made

  • Deleted src/components/SistentNavigation/content.js to remove technical debt.
  • Updated SistentPagination to dynamically fetch all Sistent MDX nodes.
  • Implemented JS-filtering to ignore drafts (published: false), while successfully pulling grouped tabs (overview -> guidance -> code) belonging to published components.
  • Enforced a strict algebraic sort via componentSlug to guarantee proper alphabetical sequencing.

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Rishi Raj <rishiraj438gt@gmail.com>
Copy link
Copy Markdown
Contributor

@YASHMAHAKAL YASHMAHAKAL left a comment

Choose a reason for hiding this comment

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

Looks good @rishiraj38

@arjunmehta-git
Copy link
Copy Markdown

Solid refactoring, @rishiraj38. Replacing the hardcoded content.js array with a dynamic useStaticQuery GraphQL call is the right long-term approach — it eliminates an entire class of "forgot to update the nav" bugs when new Sistent components are added.

One coordination item to flag: #7582 (Card component docs) added entries to content.js as part of its review cycle. Since this PR deletes content.js entirely, these two PRs are on a collision course. Whoever merges second will need to make sure the Card entries are reflected in the new dynamic query behavior. Please coordinate with @abhay1999 to confirm the Card MDX pages will be picked up correctly by the new GraphQL routing before either PR merges.

Also worth confirming:

  • The draft filtering (published: false) works as expected and doesn't accidentally hide any currently-published components
  • The alphabetical sort via componentSlug produces the same ordering as the old content.js array (a quick side-by-side comparison would be reassuring)

Good work eliminating that technical debt.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR refactors Sistent pagination to derive component/tab routes dynamically from Sistent MDX nodes via Gatsby useStaticQuery, removing the large manually-maintained content.js list.

Changes:

  • Replace static content.js pagination data with a GraphQL allMdx query + derived route list.
  • Filter pagination to only include pages for components whose overview page is published: true, and order tabs (overview → guidance → code).
  • Remove src/components/SistentNavigation/content.js and inline remaining stable routes in pagination.js.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.

File Description
src/components/SistentNavigation/pagination.js Adds useStaticQuery and runtime route derivation/sorting for pagination, plus a small stable-route prefix list.
src/components/SistentNavigation/content.js Deletes the hardcoded pagination array previously used by Sistent pagination.

Signed-off-by: Rishi Raj <rishiraj438gt@gmail.com>
@rishiraj38
Copy link
Copy Markdown
Member Author

rishiraj38 commented Apr 9, 2026

@Rajesh-Nagarajan-11, I’m not sure what’s happening with my Laptop. I can’t make a site and I can’t build it either. It keeps saying JavaScript heap out of memory. I’ve tried everything: reducing thread pools , reduced gatsby cpu counts and max space size, but nothing works.

@Junnygram
Copy link
Copy Markdown
Contributor

Junnygram commented Apr 9, 2026

Well clean cache and use NODE_OPTIONS=--max-old-space-size=4096 (or even 8192) before running the build.. @rishiraj38 , I think that should work

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.

[Sistent] Make Sistent navigation and pagination dynamic from MDX content

6 participants