From 840e921e96f51b4c00b9dcdbeceacfe451daa483 Mon Sep 17 00:00:00 2001 From: balibabu Date: Thu, 27 Jun 2024 18:09:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20set=20the=20edge=20as=20the=20data=20so?= =?UTF-8?q?urce=20to=20achieve=20two-way=20linkage=20betw=E2=80=A6=20(#129?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What problem does this PR solve? feat: set the edge as the data source to achieve two-way linkage between the edge and the to field. #918 ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- .../flow/canvas/node/categorize-handle.tsx | 3 +- .../categorize-form/dynamic-categorize.tsx | 9 ++- web/src/pages/flow/categorize-form/hooks.ts | 58 +++++++++---------- web/src/pages/flow/hooks.ts | 2 +- web/src/pages/flow/store.ts | 18 ++++-- 5 files changed, 49 insertions(+), 41 deletions(-) diff --git a/web/src/pages/flow/canvas/node/categorize-handle.tsx b/web/src/pages/flow/canvas/node/categorize-handle.tsx index 2d4329734..24dd7faed 100644 --- a/web/src/pages/flow/canvas/node/categorize-handle.tsx +++ b/web/src/pages/flow/canvas/node/categorize-handle.tsx @@ -22,7 +22,8 @@ const CategorizeHandle = ({ top, right, text, idx }: IProps) => { { const updateNodeInternals = useUpdateNodeInternals(); const form = Form.useFormInstance(); const options = useBuildCategorizeToOptions(); - const { handleSelectChange } = useHandleToSelectChange( - options.map((x) => x.value), - nodeId, - ); + const { handleSelectChange } = useHandleToSelectChange(nodeId); return ( <> @@ -64,7 +61,9 @@ const DynamicCategorize = ({ nodeId }: IProps) => {