From 917880e45f26ddb7e7b622b574d20d2a190d7b1a Mon Sep 17 00:00:00 2001 From: Imiss-U1025 Date: Tue, 11 Feb 2025 01:49:32 -0500 Subject: [PATCH] Check for uniqueness of variable name within new cloned query --- client/packages/lowcoder/src/comps/queries/queryComp.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/packages/lowcoder/src/comps/queries/queryComp.tsx b/client/packages/lowcoder/src/comps/queries/queryComp.tsx index 066b351fe..31e101b85 100644 --- a/client/packages/lowcoder/src/comps/queries/queryComp.tsx +++ b/client/packages/lowcoder/src/comps/queries/queryComp.tsx @@ -777,13 +777,15 @@ class QueryListComp extends QueryListTmpComp implements BottomResListComp { const jsonData = originQuery.toJsonValue(); //Regenerate variable header + const newKeys:string[] = []; jsonData.variables?.variables?.forEach(kv => { const [prefix, _] = (kv.key as string).split(/(?=\d+$)/); let i=1, newName = ""; do { newName = prefix + (i++); - } while(editorState.checkRename("", newName)); + } while(editorState.checkRename("", newName) || newKeys.includes(newName)); kv.key = newName; + newKeys.push(newName); }) const newQueryName = this.genNewName(editorState);