From 6a21ce0d592c2f30201e593a8356965210ea4cf0 Mon Sep 17 00:00:00 2001 From: ZLY Date: Tue, 14 Oct 2025 14:51:46 +0800 Subject: [PATCH] =?UTF-8?q?pref(flowEditor):=20=E5=88=A0=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E7=BB=84=E4=BB=B6=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96redux=E4=B8=ADDispatch=E7=9A=84ts?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useFlowEditorState.ts | 4 +++- src/pages/flowEditor/index.tsx | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useFlowEditorState.ts b/src/hooks/useFlowEditorState.ts index 510a8f8..04220ca 100644 --- a/src/hooks/useFlowEditorState.ts +++ b/src/hooks/useFlowEditorState.ts @@ -4,6 +4,8 @@ import { debounce } from 'lodash'; import { useSelector, useDispatch } from 'react-redux'; import { updateCanvasDataMap } from '@/store/ideContainer'; +import { Dispatch } from 'redux'; + export const useFlowEditorState = (initialData?: any) => { const [nodes, setNodes] = useState([]); const [edges, setEdges] = useState([]); @@ -27,7 +29,7 @@ export const useFlowEditorState = (initialData?: any) => { const historyTimeoutRef = useRef(null); const updateCanvasDataMapDebounced = useRef( - debounce((dispatch: Function, canvasDataMap: any, id: string, nodes: Node[], edges: Edge[]) => { + debounce((dispatch: Dispatch, canvasDataMap: any, id: string, nodes: Node[], edges: Edge[]) => { dispatch(updateCanvasDataMap({ ...canvasDataMap, [id]: { nodes, edges } diff --git a/src/pages/flowEditor/index.tsx b/src/pages/flowEditor/index.tsx index 50b4b7b..e4ae4d5 100644 --- a/src/pages/flowEditor/index.tsx +++ b/src/pages/flowEditor/index.tsx @@ -6,9 +6,7 @@ import { Node, Edge } from '@xyflow/react'; -import { useSelector, useDispatch } from 'react-redux'; import { nodeTypes } from '@/components/FlowEditor/node'; -import SideBar from './sideBar/sideBar'; import HistoryProvider from './components/historyContext'; import FlowEditorMain from './FlowEditorMain'; import { useFlowEditorState } from '@/hooks/useFlowEditorState';