Skip to content

Commit 221a848

Browse files
authored
Merge pull request #1509 from lowcoder-org/fix/global_unique_variable_name
Make the variable name unique among editorState
2 parents 296e25b + 0e64a0e commit 221a848

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

client/packages/lowcoder/src/comps/comps/simpleVariableHeaderComp.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { ControlParams } from "comps/controls/controlParams";
2+
import { EditorContext } from "comps/editorState";
23
import { CompAction, SimpleComp } from "lowcoder-core";
34
import { ControlPropertyViewWrapper, PopupCard, Input } from "lowcoder-design";
4-
import { useEffect, useState } from "react";
5+
import { useContext, useEffect, useState } from "react";
56
import { trans } from "i18n";
6-
import { checkName } from "../utils/rename";
77
const SimpleVariableHeaderPropertyView = ({params, comp, isCheck}: any) => {
88
const [error, setError] = useState<string | undefined>();
99
const [value, setValue] = useState(comp.value);
10+
const editorState = useContext(EditorContext);
1011
useEffect(() => {
1112
setValue(comp.value);
1213
isCheck && setError(undefined);
@@ -17,7 +18,7 @@ const SimpleVariableHeaderPropertyView = ({params, comp, isCheck}: any) => {
1718
value={value}
1819
placeholder={params.placeholder}
1920
onChange={(e) => {
20-
const error = isCheck && checkName(e.target.value);
21+
const error = isCheck && editorState.checkRename(value, e.target.value);
2122
isCheck && setError(error || undefined);
2223
setValue(e.target.value);
2324
}}

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