From af00f2cad8b6a96440e415fa998ebf55954c407a Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 22 Jul 2025 11:27:57 +0800 Subject: [PATCH] Fix: Fixed the issue that the key parameter duplication check of the begin operator was incorrect #3221 (#8964) ### What problem does this PR solve? Fix: Fixed the issue that the key parameter duplication check of the begin operator was incorrect #3221 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) --- web/src/pages/agent/form/begin-form/use-edit-query.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web/src/pages/agent/form/begin-form/use-edit-query.ts b/web/src/pages/agent/form/begin-form/use-edit-query.ts index 80e060411..6942ba88b 100644 --- a/web/src/pages/agent/form/begin-form/use-edit-query.ts +++ b/web/src/pages/agent/form/begin-form/use-edit-query.ts @@ -1,7 +1,7 @@ import { useSetModalState } from '@/hooks/common-hooks'; import { useSetSelectedRecord } from '@/hooks/logic-hooks'; import { useCallback, useMemo, useState } from 'react'; -import { UseFormReturn } from 'react-hook-form'; +import { UseFormReturn, useWatch } from 'react-hook-form'; import { BeginQuery, INextOperatorForm } from '../../interface'; export const useEditQueryRecord = ({ @@ -10,11 +10,14 @@ export const useEditQueryRecord = ({ const { setRecord, currentRecord } = useSetSelectedRecord(); const { visible, hideModal, showModal } = useSetModalState(); const [index, setIndex] = useState(-1); + const inputs: BeginQuery[] = useWatch({ + control: form.control, + name: 'inputs', + }); const otherThanCurrentQuery = useMemo(() => { - const inputs: BeginQuery[] = form?.getValues('inputs') || []; return inputs.filter((item, idx) => idx !== index); - }, [form, index]); + }, [index, inputs]); const handleEditRecord = useCallback( (record: BeginQuery) => {