Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions src/apps/review/src/lib/hooks/useFetchAiWorkflowRuns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback, useEffect, useState } from 'react'
import useSWR, { SWRResponse } from 'swr'

import { EnvironmentConfig } from '~/config'
import { xhrGetAsync, xhrGetBlobAsync } from '~/libs/core'
import { xhrGetBlobAsync } from '~/libs/core'
import { handleError } from '~/libs/shared/lib/utils/handle-error'

import { AiFeedbackItem, Scorecard } from '../models'
Expand Down Expand Up @@ -119,16 +119,8 @@ export function useFetchAiWorkflowsRuns(
error: fetchError,
isValidating: isLoading,
}: SWRResponse<AiWorkflowRun[], Error> = useSWR<AiWorkflowRun[], Error>(
`${TC_API_BASE_URL}/workflows/${workflowIds.join(',')}/runs?submissionId=${submissionId}`,
`${TC_API_BASE_URL}/workflows/runs?submissionId=${submissionId}`,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[❗❗ correctness]
The new endpoint ${TC_API_BASE_URL}/workflows/runs?submissionId=${submissionId} does not include workflowIds in the URL. Ensure that the backend supports fetching runs for multiple workflows without specifying their IDs, or this change may lead to incorrect data being fetched.

{
fetcher: () => Promise.all(
workflowIds.map(workflowId => (
xhrGetAsync<AiWorkflowRun>(
`${TC_API_BASE_URL}/workflows/${workflowId}/runs?submissionId=${submissionId}`,
)
)),
)
.then(results => results.flat()),
isPaused: () => !workflowIds?.length || !submissionId,
},
)
Expand Down
Loading