GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf(webapp): clamp list-endpoint page size to 100 · triggerdotdev/trigger.dev@350c680

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .server-changes
    • cap-list-endpoint-page-size.md
  • apps/webapp/app/routes
    • admin.api.v1.environments.$environmentId.engine.report.ts
    • admin.api.v1.llm-models.ts
    • api.v1.queues.ts
    • api.v1.schedules.ts
    • resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues.ts
    • resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.versions.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.server-changes/cap-list-endpoint-page-size.md‎

Copy file name to clipboard
+6Lines changed: 6 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
area: webapp
3+
type: improvement
4+
---
5+
6+
List API endpoints now clamp the page size to a maximum of 100. Requests asking for a larger page size return up to 100 items and keep paginating, rather than pulling an unbounded page.
Collapse file

‎apps/webapp/app/routes/admin.api.v1.environments.$environmentId.engine.report.ts‎

Copy file name to clipboardExpand all lines: apps/webapp/app/routes/admin.api.v1.environments.$environmentId.engine.report.ts
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@ const ParamsSchema = z.object({
1313
const SearchParamsSchema = z.object({
1414
verbose: z.string().default("0"),
1515
page: z.coerce.number().optional(),
16-
per_page: z.coerce.number().optional(),
16+
per_page: z.coerce
17+
.number()
18+
.int()
19+
.positive()
20+
.transform((n) => Math.min(n, 100))
21+
.optional(),
1722
});
1823

1924
export async function loader({ request, params }: LoaderFunctionArgs) {
Collapse file

‎apps/webapp/app/routes/admin.api.v1.llm-models.ts‎

Copy file name to clipboardExpand all lines: apps/webapp/app/routes/admin.api.v1.llm-models.ts
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ export async function loader({ request }: LoaderFunctionArgs) {
99

1010
const url = new URL(request.url);
1111
const page = parseInt(url.searchParams.get("page") ?? "1");
12-
const pageSize = parseInt(url.searchParams.get("pageSize") ?? "50");
12+
const pageSize = Math.max(
13+
1,
14+
Math.min(parseInt(url.searchParams.get("pageSize") ?? "50") || 50, 100)
15+
);
1316

1417
const [models, total] = await Promise.all([
1518
prisma.llmModel.findMany({
Collapse file

‎apps/webapp/app/routes/api.v1.queues.ts‎

Copy file name to clipboardExpand all lines: apps/webapp/app/routes/api.v1.queues.ts
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import { ServiceValidationError } from "~/v3/services/baseService.server";
1212

1313
const SearchParamsSchema = z.object({
1414
page: z.coerce.number().int().positive().optional(),
15-
perPage: z.coerce.number().int().positive().optional(),
15+
perPage: z.coerce
16+
.number()
17+
.int()
18+
.positive()
19+
.transform((n) => Math.min(n, 100))
20+
.optional(),
1621
});
1722

1823
export const loader = createLoaderApiRoute(
Collapse file

‎apps/webapp/app/routes/api.v1.schedules.ts‎

Copy file name to clipboardExpand all lines: apps/webapp/app/routes/api.v1.schedules.ts
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ import { UpsertTaskScheduleService } from "~/v3/services/upsertTaskSchedule.serv
1212

1313
const SearchParamsSchema = z.object({
1414
page: z.coerce.number().int().positive().optional(),
15-
perPage: z.coerce.number().int().positive().optional(),
15+
perPage: z.coerce
16+
.number()
17+
.int()
18+
.positive()
19+
.transform((n) => Math.min(n, 100))
20+
.optional(),
1621
});
1722

1823
export async function action({ request }: ActionFunctionArgs) {
Collapse file

‎apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues.ts‎

Copy file name to clipboardExpand all lines: apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.queues.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ import { EnvironmentParamSchema } from "~/utils/pathBuilder";
99
const SearchParamsSchema = z.object({
1010
query: z.string().optional(),
1111
page: z.coerce.number().min(1).default(1),
12-
per_page: z.coerce.number().min(1).default(20),
12+
per_page: z.coerce
13+
.number()
14+
.min(1)
15+
.transform((n) => Math.min(n, 100))
16+
.default(20),
1317
type: z.enum(["task", "custom"]).optional(),
1418
});
1519

Collapse file

‎apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.versions.ts‎

Copy file name to clipboardExpand all lines: apps/webapp/app/routes/resources.orgs.$organizationSlug.projects.$projectParam.env.$envParam.versions.ts
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import { EnvironmentParamSchema } from "~/utils/pathBuilder";
88

99
const SearchParamsSchema = z.object({
1010
query: z.string().optional(),
11-
per_page: z.coerce.number().min(1).default(25),
11+
per_page: z.coerce
12+
.number()
13+
.min(1)
14+
.transform((n) => Math.min(n, 100))
15+
.default(25),
1216
});
1317

1418
export async function loader({ request, params }: LoaderFunctionArgs) {

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.