feat: add cursor-based pagination to projects showcase - #806
Merged
Aditya948351 merged 2 commits intoJul 8, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #755 — adds a generic
Pagination.tsxcomponent and Firestore cursor-based pagination (startAfter,limit) to the Projects Showcase tab on the Community page, so it fetches data one page at a time instead of relying on a single capped query.Changes
New:
src/components/common/Pagination.tsxA reusable, presentation-only pagination component:
Previous/Nextbuttons with disabled states when there's no previous/next pageloadingprop)src/app/community/page.tsxlimit(20)query with cursor-based pagination:PAGE_SIZE + 1documents per request so we can detect whether a next page exists without a second querypageCursorsstack ofQueryDocumentSnapshots, so "Previous" can navigate backward without needing Firestore's (nonexistent) native backward cursorstartAfter(cursor)is used for "Next"; popping the cursor stack and re-fetching handles "Previous"Newest/Popular) changes<Pagination>component below the projects grid, visible only on the Showcase tabKnown limitation (pre-existing, not introduced by this PR)
Client-side search (Fuse.js) only searches within the currently loaded page of projects, since it operates on the fetched
projectsarray rather than the full Firestore collection. This was already the case before this change — pagination doesn't make it worse, but it does make it more visible, so the<Pagination>controls are hidden while a search query is active to avoid confusion.How to test
npm run devVerified locally with 25 seeded test projects — pagination correctly showed page 1 (20 projects) → clicked Next → showed remaining 5 (page 2, Next disabled) → clicked Previous → returned to page 1. Sort toggling correctly reset pagination to page 1.
Related Issue
Closes #755