Skip to content

Commit 28721d2

Browse files
committed
fix: enhance component field-array expression
1 parent ce6b525 commit 28721d2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/v2/logic/createForm.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -362,19 +362,19 @@ const createForm = <TSchema>(props: ICreateFormProps<TSchema>) => {
362362

363363
for (const { condition, expression, values } of schema.overrides) {
364364
if (!expression) {
365-
setValues({ ...values }, { skipNotify: true });
365+
setValues(structuredClone(values), { skipNotify: true });
366366
break;
367367
}
368368

369369
try {
370370
const result = parse(expression, { ...options.extraData });
371371
if (condition === !!result) {
372-
setValues({ ...values }, { skipNotify: true });
372+
setValues(structuredClone(values), { skipNotify: true });
373373
break;
374374
}
375375
} catch (error) {
376376
if (!condition) {
377-
setValues({ ...values }, { skipNotify: true });
377+
setValues(structuredClone(values), { skipNotify: true });
378378
break;
379379
}
380380
}
@@ -425,6 +425,7 @@ const createForm = <TSchema>(props: ICreateFormProps<TSchema>) => {
425425
executeEachExpression(schema as ISchema[], {
426426
parent: `${options.parent}.${index}`,
427427
extraData: {
428+
__ITEM__: getValue(`${options.parent}.${index}`),
428429
__INDEX__: index,
429430
},
430431
});

0 commit comments

Comments
 (0)