mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-23 01:35:26 +00:00
fix(web): Fix repo pagination (#689)
Some checks are pending
Update Roadmap Released / update (push) Waiting to run
Some checks are pending
Update Roadmap Released / update (push) Waiting to run
This commit is contained in:
parent
3dc5019ea2
commit
84e53c8576
2 changed files with 10 additions and 4 deletions
|
|
@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Changed
|
||||
- Bake Sourcebot version into code rather than relying on build arg. [#680](https://github.com/sourcebot-dev/sourcebot/pull/680)
|
||||
- Fix issue with `/repos` page pagination. [#689](https://github.com/sourcebot-dev/sourcebot/pull/689)
|
||||
|
||||
## [4.10.4] - 2025-12-18
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ import { ReposTable } from "./components/reposTable";
|
|||
import { RepoIndexingJobStatus, Prisma } from "@sourcebot/db";
|
||||
import z from "zod";
|
||||
|
||||
const numberSchema = z.coerce.number().int().positive();
|
||||
|
||||
interface ReposPageProps {
|
||||
searchParams: Promise<{
|
||||
page?: string;
|
||||
|
|
@ -17,12 +19,15 @@ interface ReposPageProps {
|
|||
}>;
|
||||
}
|
||||
|
||||
export default async function ReposPage({ searchParams }: ReposPageProps) {
|
||||
const params = await searchParams;
|
||||
export default async function ReposPage(props: ReposPageProps) {
|
||||
const params = await props.searchParams;
|
||||
|
||||
console.log('asdf:');
|
||||
console.log(z.coerce.number().int().safeParse(params.page).error);
|
||||
|
||||
// Parse pagination parameters with defaults
|
||||
const page = z.number().int().positive().safeParse(params.page).data ?? 1;
|
||||
const pageSize = z.number().int().positive().safeParse(params.pageSize).data ?? 5;
|
||||
const page = numberSchema.safeParse(params.page).data ?? 1;
|
||||
const pageSize = numberSchema.safeParse(params.pageSize).data ?? 5;
|
||||
|
||||
// Parse filter parameters
|
||||
const search = z.string().optional().safeParse(params.search).data ?? '';
|
||||
|
|
|
|||
Loading…
Reference in a new issue