mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
refactor(web): migrate workflow run history from useSWR to TanStack Query (#30077)
This commit is contained in:
@ -9,6 +9,7 @@ import type {
|
||||
UpdateWorkflowParams,
|
||||
VarInInspect,
|
||||
WorkflowConfigResponse,
|
||||
WorkflowRunHistoryResponse,
|
||||
} from '@/types/workflow'
|
||||
import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from '@tanstack/react-query'
|
||||
import { del, get, patch, post, put } from './base'
|
||||
@ -25,6 +26,14 @@ export const useAppWorkflow = (appID: string) => {
|
||||
})
|
||||
}
|
||||
|
||||
export const useWorkflowRunHistory = (url?: string, enabled = true) => {
|
||||
return useQuery<WorkflowRunHistoryResponse>({
|
||||
queryKey: [NAME_SPACE, 'runHistory', url],
|
||||
queryFn: () => get<WorkflowRunHistoryResponse>(url as string),
|
||||
enabled: !!url && enabled,
|
||||
})
|
||||
}
|
||||
|
||||
export const useInvalidateAppWorkflow = () => {
|
||||
const queryClient = useQueryClient()
|
||||
return (appID: string) => {
|
||||
|
||||
Reference in New Issue
Block a user