fix: linkage rule config closing rules require reopening the form to take effect (#1640)
This commit is contained in:
parent
7036879ea6
commit
ffcf1d9cf1
@ -114,9 +114,11 @@ const WithForm = (props) => {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (linkageRules.length > 0) {
|
||||||
const id = uid();
|
const id = uid();
|
||||||
form.addEffects(id, () => {
|
|
||||||
const linkagefields = [];
|
const linkagefields = [];
|
||||||
|
const formGraph = form.getFormGraph();
|
||||||
|
form.addEffects(id, () => {
|
||||||
return linkageRules.map((v, index) => {
|
return linkageRules.map((v, index) => {
|
||||||
return v.actions?.map((h) => {
|
return v.actions?.map((h) => {
|
||||||
if (h.targetFields) {
|
if (h.targetFields) {
|
||||||
@ -138,7 +140,10 @@ const WithForm = (props) => {
|
|||||||
});
|
});
|
||||||
return () => {
|
return () => {
|
||||||
form.removeEffects(id);
|
form.removeEffects(id);
|
||||||
|
form.clearFormGraph();
|
||||||
|
form.setFormGraph(formGraph);
|
||||||
};
|
};
|
||||||
|
}
|
||||||
}, [linkageRules]);
|
}, [linkageRules]);
|
||||||
return fieldSchema['x-decorator'] === 'Form' ? <FormDecorator {...props} /> : <FormComponent {...props} />;
|
return fieldSchema['x-decorator'] === 'Form' ? <FormDecorator {...props} /> : <FormComponent {...props} />;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user