Description
Problems.tsx fetches the entire problem dataset in a single GET /api/content/problems request and renders every problem at once. The backend getAllProblems in contentController.ts uses prisma.problem.findMany() with no take or skip. As the problem set scales, this causes increasingly large API responses, slow renders, and an oversized DOM tree.
Requirements
- Add
page and limit query parameters to GET /api/content/problems (default: page=1, limit=25).
- Return pagination metadata in the response:
{ data, totalCount, page, totalPages }.
- Implement a "Load More" button or IntersectionObserver infinite scroll in
Problems.tsx.
- Changing any filter (difficulty, tag, search) resets pagination to page 1.
Expected Behavior
Initial Load — The first 25 problems are fetched and displayed.
"Load More" / Scroll to Bottom — The next 25 problems are fetched and appended to the list.
Filter Change — Pagination resets to page 1 and only the filtered result set is fetched.
Tasks
Acceptance Criteria
Description
Problems.tsxfetches the entire problem dataset in a singleGET /api/content/problemsrequest and renders every problem at once. The backendgetAllProblemsincontentController.tsusesprisma.problem.findMany()with notakeorskip. As the problem set scales, this causes increasingly large API responses, slow renders, and an oversized DOM tree.Requirements
pageandlimitquery parameters toGET /api/content/problems(default:page=1,limit=25).{ data, totalCount, page, totalPages }.Problems.tsx.Expected Behavior
Initial Load — The first 25 problems are fetched and displayed.
"Load More" / Scroll to Bottom — The next 25 problems are fetched and appended to the list.
Filter Change — Pagination resets to page 1 and only the filtered result set is fetched.
Tasks
getAllProblemsincontentController.tsto acceptpageandlimitquery params using Prismaskip/take.{ data, totalCount, page, totalPages }in the response.getAllProblemsAPI function inapp/src/api/content.tsto pass pagination params.Problems.tsx.Acceptance Criteria
GET /api/content/problems?page=1&limit=25returns exactly 25 problems with metadata.