Skip to content

Commit 917880e

Browse files
committed
Check for uniqueness of variable name within new cloned query
1 parent 0cd9490 commit 917880e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

client/packages/lowcoder/src/comps/queries/queryComp.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -777,13 +777,15 @@ class QueryListComp extends QueryListTmpComp implements BottomResListComp {
777777

778778
const jsonData = originQuery.toJsonValue();
779779
//Regenerate variable header
780+
const newKeys:string[] = [];
780781
jsonData.variables?.variables?.forEach(kv => {
781782
const [prefix, _] = (kv.key as string).split(/(?=\d+$)/);
782783
let i=1, newName = "";
783784
do {
784785
newName = prefix + (i++);
785-
} while(editorState.checkRename("", newName));
786+
} while(editorState.checkRename("", newName) || newKeys.includes(newName));
786787
kv.key = newName;
788+
newKeys.push(newName);
787789
})
788790

789791
const newQueryName = this.genNewName(editorState);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy