Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/app/api/users/[username]/followers/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function GET(
const supabase = await createClient();
const searchParams = request.nextUrl.searchParams;
const limit = parsePositiveInt(searchParams.get("limit"), 20, 100);
const offset = parseNonNegativeInt(searchParams.get("offset"), 0);
const offset = Math.min(parseNonNegativeInt(searchParams.get("offset"), 0), 100_000);
Comment on lines 29 to +30
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Inconsistent pagination helper vs. sibling endpoints

The activity route uses a shared parsePaginationParam utility from @/lib/api-pagination which already accepts a max argument (e.g. parsePaginationParam(searchParams.get("offset"), 0, 0, 100_000)). This file (and following/route.ts) duplicates parsePositiveInt / parseNonNegativeInt locally and wraps them with an inline Math.min. Using the shared helper would keep the offset-cap boundary in one place and reduce the surface for future drift.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!


// Look up target user
const { data: targetProfile, error: profileError } = await supabase
Expand Down
2 changes: 1 addition & 1 deletion src/app/api/users/[username]/following/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export async function GET(
const supabase = await createClient();
const searchParams = request.nextUrl.searchParams;
const limit = parsePositiveInt(searchParams.get("limit"), 20, 100);
const offset = parseNonNegativeInt(searchParams.get("offset"), 0);
const offset = Math.min(parseNonNegativeInt(searchParams.get("offset"), 0), 100_000);

// Look up target user
const { data: targetProfile, error: profileError } = await supabase
Expand Down
Loading