Skip to content

Commit 81675e2

Browse files
authored
Merge pull request #1437 from topcoder-platform/PS-512_filter-out-duplicate-ai-runs
PS-512 - Show only last runs for ai workflows
2 parents 877e5da + bd7f50c commit 81675e2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/apps/review/src/lib/hooks/useFetchAiWorkflowRuns.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useCallback, useEffect, useRef, useState } from 'react'
2+
import { orderBy, uniqBy } from 'lodash'
23
import useSWR, { SWRResponse } from 'swr'
34

45
import { EnvironmentConfig } from '~/config'
@@ -141,9 +142,12 @@ export function useFetchAiWorkflowsRuns(
141142
}
142143
}, [fetchError])
143144

145+
const uniqueRuns = uniqBy(orderBy(runs, 'completedAt', 'desc'), 'workflow.id')
146+
.reverse()
147+
144148
return {
145149
isLoading,
146-
runs,
150+
runs: uniqueRuns,
147151
}
148152
}
149153

0 commit comments

Comments
 (0)