Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Performance: Add pagination/infinite scroll to directory for large datasets

未关闭
#28 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃

调研方向

Start by reading src/app/directory/page.tsx and src/lib/resources.ts to trace how getAllResources() loads the full dataset, then inspect src/components/directory/directory-client.tsx and its PAGE_SIZE behavior. Use the existing directory flow as the entry point; done means resources are fetched in pages and the directory uses pagination or infinite scroll without loading all approved resources server-side.

由索引模型根据 Issue 内容生成。

描述

enhancement good first issue

Description

The directory currently loads all resources server-side (~600 rows) and paginates client-side with a "Load more" button (30 per page, src/components/directory/directory-client.tsx line 15). As the dataset grows, this will become a performance issue.

Current State

  • src/app/directory/page.tsx loads ALL resources via getAllResources() (line 23-24)
  • src/lib/resources.ts getAllResources() fetches all approved resources (line 71-83)
  • Client-side pagination in DirectoryClient with PAGE_SIZE = 30 (line 15)

Expected Behavior

Implement server-side pagination with cursor or offset-based pagination:

  1. Add page/limit or cursor/limit params to directory URL
  2. Modify getAllResources() to accept pagination params
  3. Update DirectoryClient to fetch next page via API or Server Action
  4. Replace "Load more" with infinite scroll or paginated navigation

Good First Issue Because

  • Clear performance improvement
  • Involves both frontend and backend changes
  • Good for learning Next.js data fetching patterns
  • Can be done incrementally (API first, then UI)

Files to Modify

  • src/app/directory/page.tsx - add pagination params, pass to client
  • src/lib/resources.ts - add getResourcesPaginated() function
  • src/components/directory/directory-client.tsx - implement infinite scroll or pagination UI
  • src/app/api/resources/route.ts (new) - API endpoint for paginated fetching

Implementation Approach

Option A: Offset-based (?page=2&limit=30) - simpler, but can have issues with concurrent updates
Option B: Cursor-based (?cursor=abc123&limit=30) - better for real-time data, more complex
Option C: Keep client-side for now, add server-side when dataset > 1000

Given current size (~600), Option A is fine for now.

主要语言
TypeScript
星标
1
派生
6
平均合并
11 小时 16 分钟
30 天内合并 PR
16

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Your-Voldemort/StudentStack 的其他 Issue

查看 Your-Voldemort/StudentStack 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。