diff --git a/web/app/components/datasets/documents/create-from-pipeline/hooks.ts b/web/app/components/datasets/documents/create-from-pipeline/hooks.ts index da27a22cfa..49f9dc359b 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/hooks.ts +++ b/web/app/components/datasets/documents/create-from-pipeline/hooks.ts @@ -80,7 +80,7 @@ export const useLocalFile = () => { const [fileList, setFileList] = useState([]) const [currentFile, setCurrentFile] = useState() - const previewFile = useRef(fileList[0]?.file as DocumentItem) + const previewFile = useRef() const allFileLoaded = useMemo(() => (fileList.length > 0 && fileList.every(file => file.file.id)), [fileList]) @@ -93,6 +93,7 @@ export const useLocalFile = () => { } }) setFileList(newList) + previewFile.current = newList[0].file as DocumentItem } const updateFileList = useCallback((preparedFiles: FileItem[]) => { diff --git a/web/app/components/datasets/documents/create-from-pipeline/index.tsx b/web/app/components/datasets/documents/create-from-pipeline/index.tsx index f8b45dff8c..647de69b22 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/index.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/index.tsx @@ -44,6 +44,7 @@ const TestRunPanel = () => { const { data: pipelineInfo, isFetching: isFetchingPipelineInfo } = usePublishedPipelineInfo(pipelineId || '') const { + steps, currentStep, handleNextStep, handleBackStep, @@ -233,6 +234,7 @@ const TestRunPanel = () => { >
diff --git a/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx b/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx index eb03b6ef23..6ea4f3ace5 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/left-header.tsx @@ -3,20 +3,21 @@ import { RiArrowLeftLine } from '@remixicon/react' import Button from '@/app/components/base/button' import { useParams } from 'next/navigation' import Effect from '@/app/components/base/effect' -import { useAddDocumentsSteps } from './hooks' +import type { Step } from './step-indicator' import StepIndicator from './step-indicator' type LeftHeaderProps = { + steps: Array title: string currentStep: number } const LeftHeader = ({ + steps, title, currentStep, }: LeftHeaderProps) => { const { datasetId } = useParams() - const steps = useAddDocumentsSteps() return (
diff --git a/web/app/components/datasets/documents/create-from-pipeline/step-indicator.tsx b/web/app/components/datasets/documents/create-from-pipeline/step-indicator.tsx index 9db7a0446d..1c05cdedd3 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/step-indicator.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/step-indicator.tsx @@ -1,7 +1,7 @@ import cn from '@/utils/classnames' import React from 'react' -type Step = { +export type Step = { label: string value: string }