Skip to content

Commit cf584f1

Browse files
committed
fix(inbox): page tasks with the contract's named page limit
1 parent 3689c1e commit cf584f1

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

‎apps/sim/hooks/queries/inbox.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { requestJson } from '@/lib/api/client/request'
1010
import {
1111
addInboxSenderContract,
1212
getInboxConfigContract,
13+
INBOX_TASKS_PAGE_LIMIT,
1314
type InboxConfig,
1415
type InboxSendersResponseBody,
1516
type InboxTask,
@@ -70,6 +71,7 @@ async function fetchInboxTasks(
7071
query: {
7172
status: opts.status && opts.status !== 'all' ? opts.status : undefined,
7273
cursor: opts.cursor,
74+
limit: INBOX_TASKS_PAGE_LIMIT,
7375
},
7476
signal,
7577
})

‎apps/sim/lib/api/contracts/inbox.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ export const deleteInboxSenderBodySchema = z.object({
7979
senderId: z.string().min(1),
8080
})
8181

82+
/** The most inbox tasks one page returns; the route clamps any larger `limit` to it. */
83+
export const INBOX_TASKS_PAGE_LIMIT = 50
84+
8285
export const inboxTasksQuerySchema = z.object({
8386
status: inboxTaskStatusSchema.optional(),
8487
cursor: z.string().optional(),
@@ -87,7 +90,9 @@ export const inboxTasksQuerySchema = z.object({
8790
z.coerce
8891
.number()
8992
.optional()
90-
.transform((value) => (value === undefined ? undefined : Math.min(value, 50)))
93+
.transform((value) =>
94+
value === undefined ? undefined : Math.min(value, INBOX_TASKS_PAGE_LIMIT)
95+
)
9196
),
9297
})
9398

0 commit comments

Comments
 (0)