From 5896bc89f5e2d1f939fc5a3b35c63b43341a6121 Mon Sep 17 00:00:00 2001
From: yyh <92089059+lyzno1@users.noreply.github.com>
Date: Wed, 24 Dec 2025 18:21:01 +0800
Subject: [PATCH] refactor(web): migrate workflow run history from useSWR to
TanStack Query (#30077)
---
.../components/rag-pipeline-header/index.tsx | 2 --
.../components/workflow-header/index.spec.tsx | 11 --------
.../components/workflow-header/index.tsx | 4 ---
.../workflow/header/view-history.tsx | 11 +++-----
web/service/use-workflow.ts | 9 +++++++
web/service/workflow.ts | 27 +++++--------------
6 files changed, 19 insertions(+), 45 deletions(-)
diff --git a/web/app/components/rag-pipeline/components/rag-pipeline-header/index.tsx b/web/app/components/rag-pipeline/components/rag-pipeline-header/index.tsx
index fff720469c..fe2490f281 100644
--- a/web/app/components/rag-pipeline/components/rag-pipeline-header/index.tsx
+++ b/web/app/components/rag-pipeline/components/rag-pipeline-header/index.tsx
@@ -8,7 +8,6 @@ import Header from '@/app/components/workflow/header'
import {
useStore,
} from '@/app/components/workflow/store'
-import { fetchWorkflowRunHistory } from '@/service/workflow'
import InputFieldButton from './input-field-button'
import Publisher from './publisher'
import RunMode from './run-mode'
@@ -21,7 +20,6 @@ const RagPipelineHeader = () => {
const viewHistoryProps = useMemo(() => {
return {
historyUrl: `/rag/pipelines/${pipelineId}/workflow-runs`,
- historyFetcher: fetchWorkflowRunHistory,
}
}, [pipelineId])
diff --git a/web/app/components/workflow-app/components/workflow-header/index.spec.tsx b/web/app/components/workflow-app/components/workflow-header/index.spec.tsx
index 87d7fb30e7..5563af01d3 100644
--- a/web/app/components/workflow-app/components/workflow-header/index.spec.tsx
+++ b/web/app/components/workflow-app/components/workflow-header/index.spec.tsx
@@ -58,16 +58,12 @@ vi.mock('@/app/components/app/store', () => ({
vi.mock('@/app/components/workflow/header', () => ({
__esModule: true,
default: (props: HeaderProps) => {
- const historyFetcher = props.normal?.runAndHistoryProps?.viewHistoryProps?.historyFetcher
- const hasHistoryFetcher = typeof historyFetcher === 'function'
-
return (