Skip to content

Commit 71258f6

Browse files
author
Yofriadi Yahya
committed
saving
1 parent f6c4250 commit 71258f6

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

lowcoder-comp-stone-parcel-input/src/StoneParcelComp.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,11 @@ let StoneParcelComp = new UICompBuilder(
112112
const handleClose = (i: number) => {
113113
setParcelValues(parcelValues.toSpliced(i, 1));
114114
};
115-
const handleAdd = () => {
116-
setParcelValues([...parcelValues, initValue]);
117-
props.data[parcelValues.length] = initValue;
118-
};
115+
useEffect(() => {
116+
parcelValues.map((parcelValue, i) => {
117+
props.data[i] = parcelValue;
118+
});
119+
}, [props, parcelValues]);
119120

120121
const [dimensions, setDimensions] = useState({ width: 480, height: 280 });
121122
const {
@@ -152,7 +153,7 @@ let StoneParcelComp = new UICompBuilder(
152153
type="primary"
153154
shape="circle"
154155
icon={<PlusOutlined />}
155-
onClick={handleAdd()}
156+
onClick={() => setParcelValues([...parcelValues, initValue])}
156157
></antd.Button>
157158
</Container>
158159
);

lowcoder-comp-stone-parcel-input/src/vendors/StoneParcel.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ function StoneParcel({
101101
type="primary"
102102
shape="circle"
103103
icon={<CloseOutlined />}
104-
onClick={() => {
105-
handleClose(key);
106-
data.splice(i, 1);
107-
}}
104+
onClick={() => handleClose(key)}
108105
></antd.Button>
109106
</Row>
110107
);

0 commit comments

Comments
 (0)