Skip to content

Commit

Permalink
fix: correctly parse a limit of 0 and handle negative limit
Browse files Browse the repository at this point in the history
  • Loading branch information
leon-schmid committed Nov 20, 2024
1 parent c10ead9 commit f932b89
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions web/src/hooks/use-list-workflow-runs-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HTTPMethod } from "@/types/api";

// GET /api/v1/runs/<workflow-id>
const ListWorkflowRunsRequest = z.object({
limit: z.number().optional(),
limit: z.number().min(0).optional(),
});
const ListWorkflowRunsResponse = z.array(WorkflowRunMetadata);

Expand All @@ -29,7 +29,7 @@ export const useListWorkflowRunsApi = (workflowId: string, limit?: number) => {
return useQuery({
queryKey: ["workflowRuns", workflowId, limit],
queryFn: () => {
const params = limit ? { limit } : {};
const params = typeof limit === "number" ? { limit } : {};
return buildListWorkflowRunsApi(workflowId)(params);
},
refetchInterval: REFETCH_INTERVAL_1_SECOND,
Expand Down

0 comments on commit f932b89

Please sign in to comment.