chore: handle lastrun run retry

This commit is contained in:
Joel 2025-05-22 15:07:41 +08:00
parent 2c4ea612a7
commit 650abe8a8f
3 changed files with 7 additions and 5 deletions

View File

@ -139,7 +139,6 @@ const BasePanel: FC<BasePanelProps> = ({
const {
isShowSingleRun,
showSingleRun,
hideSingleRun,
runningStatus,
handleStop,

View File

@ -30,9 +30,9 @@ const LastRun: FC<Props> = ({
...otherResultPanelProps
}) => {
const isRunning = oneStepRunRunningStatus === NodeRunningStatus.Running
// const isOneStepRunSuccess = oneStepRunRunningStatus === NodeRunningStatus.Succeeded
const isOneStepRunFailed = oneStepRunRunningStatus === NodeRunningStatus.Failed
const { data: lastRunResult, isFetching } = useLastRun(appId, nodeId, !isOneStepRunFailed)
const { data: lastRunResult, isFetching, error } = useLastRun(appId, nodeId, !isOneStepRunFailed)
const noLastRun = (error as any)?.status === 404
const runResult = (isOneStepRunFailed ? singleRunResult : lastRunResult) || {}
if (isFetching) {
@ -45,7 +45,7 @@ const LastRun: FC<Props> = ({
if (isRunning)
return <ResultPanel status='running' showSteps={false} />
if (!runResult) {
if (noLastRun || !runResult) {
return (
<NoData canSingleRun={canSingleRun} onSingleRun={onSingleRunClicked} />
)

View File

@ -94,8 +94,11 @@ export const useLastRun = (appID: string, nodeId: string, enabled: boolean) => {
enabled,
queryKey: [...useLastRunKey, appID, nodeId],
queryFn: async () => {
return get(`apps/${appID}/workflows/draft/nodes/${nodeId}/last-run`)
return get(`apps/${appID}/workflows/draft/nodes/${nodeId}/last-run`, {}, {
silent: true,
})
},
retry: 0,
})
}