diff --git a/apps/builder/src/features/results/api/getResults.ts b/apps/builder/src/features/results/api/getResults.ts index 7abf267991..7b63712652 100644 --- a/apps/builder/src/features/results/api/getResults.ts +++ b/apps/builder/src/features/results/api/getResults.ts @@ -5,7 +5,7 @@ import { ResultWithAnswers, resultWithAnswersSchema } from '@typebot.io/schemas' import { z } from 'zod' import { isReadTypebotForbidden } from '@/features/typebot/helpers/isReadTypebotForbidden' -const maxLimit = 200 +const maxLimit = 100 export const getResults = authenticatedProcedure .meta({ @@ -20,7 +20,7 @@ export const getResults = authenticatedProcedure .input( z.object({ typebotId: z.string(), - limit: z.string().regex(/^[0-9]{1,3}$/), + limit: z.coerce.number().min(1).max(maxLimit).default(50), cursor: z.string().optional(), }) ) @@ -35,7 +35,7 @@ export const getResults = authenticatedProcedure if (limit < 1 || limit > maxLimit) throw new TRPCError({ code: 'BAD_REQUEST', - message: 'limit must be between 1 and 200', + message: `limit must be between 1 and ${maxLimit}`, }) const { cursor } = input const typebot = await prisma.typebot.findUnique({ diff --git a/apps/builder/src/features/results/components/table/ExportAllResultsModal.tsx b/apps/builder/src/features/results/components/table/ExportAllResultsModal.tsx index 443a71f4fb..432619250d 100644 --- a/apps/builder/src/features/results/components/table/ExportAllResultsModal.tsx +++ b/apps/builder/src/features/results/components/table/ExportAllResultsModal.tsx @@ -59,7 +59,7 @@ export const ExportAllResultsModal = ({ isOpen, onClose }: Props) => { const { results, nextCursor } = await trpcContext.results.getResults.fetch({ typebotId, - limit: '200', + limit: 100, cursor, }) allResults.push(...results) diff --git a/apps/builder/src/features/results/hooks/useResultsQuery.ts b/apps/builder/src/features/results/hooks/useResultsQuery.ts index f07951ab2b..8c27bc8f4f 100644 --- a/apps/builder/src/features/results/hooks/useResultsQuery.ts +++ b/apps/builder/src/features/results/hooks/useResultsQuery.ts @@ -11,7 +11,6 @@ export const useResultsQuery = ({ trpc.results.getResults.useInfiniteQuery( { typebotId, - limit: '50', }, { getNextPageParam: (lastPage) => lastPage.nextCursor, diff --git a/apps/docs/openapi/builder/_spec_.json b/apps/docs/openapi/builder/_spec_.json index 23175d546b..253cd8c743 100644 --- a/apps/docs/openapi/builder/_spec_.json +++ b/apps/docs/openapi/builder/_spec_.json @@ -29833,10 +29833,12 @@ { "name": "limit", "in": "query", - "required": true, + "required": false, "schema": { - "type": "string", - "pattern": "^[0-9]{1,3}$" + "type": "number", + "minimum": 1, + "maximum": 100, + "default": 50 } }, {