Fixed circular call issue
This commit is contained in:
parent
94675ed655
commit
f8a5681b88
@ -112,7 +112,8 @@ const TemplateFiller = forwardRef<TemplateFillerHandle, TemplateFillerProps>(
|
||||
customFields: newCustomFields,
|
||||
});
|
||||
setTemplate(newTemplate);
|
||||
}, [templateId, formInstanceId, form]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [templateId, formInstanceId]);
|
||||
|
||||
useEffect(() => {
|
||||
void loadTemplate();
|
||||
|
||||
@ -71,17 +71,13 @@ const SpecificationsDetails: React.FC<SpecificationsDetailsProps> = ({
|
||||
const isEditMode = () => editMode;
|
||||
|
||||
const loadFormTemplate = useCallback(
|
||||
async (printSpecifications?: GeneralIdRef) => {
|
||||
const { data } = form.state;
|
||||
const printSpecArray =
|
||||
(data.printSpecifications as CustomFieldValue[]) || [];
|
||||
|
||||
async (printSpecArray: CustomFieldValue[]) => {
|
||||
if (printSpecArray && printSpecArray.length > 0) {
|
||||
if (
|
||||
((printSpecArray[0] as CustomFieldValue).value as GeneralIdRef).id ===
|
||||
BigInt(0)
|
||||
) {
|
||||
data.printSpecifications = undefined;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -95,12 +91,9 @@ const SpecificationsDetails: React.FC<SpecificationsDetailsProps> = ({
|
||||
}
|
||||
if (template) {
|
||||
setFormTemplate(template);
|
||||
form.setState({ loaded: true });
|
||||
} else {
|
||||
form.setState({ loaded: false });
|
||||
}
|
||||
},
|
||||
[form],
|
||||
[],
|
||||
);
|
||||
|
||||
const handleValidationChanged = useCallback(() => {
|
||||
@ -142,11 +135,10 @@ const SpecificationsDetails: React.FC<SpecificationsDetailsProps> = ({
|
||||
const { printSpecifications } = form.state.data;
|
||||
const printSpecArray = (printSpecifications as CustomFieldValue[]) || [];
|
||||
if (printSpecArray && printSpecArray.length > 0) {
|
||||
loadFormTemplate(
|
||||
(printSpecArray[0] as CustomFieldValue).value as GeneralIdRef,
|
||||
);
|
||||
loadFormTemplate(printSpecArray);
|
||||
}
|
||||
}, [form.state.data.printSpecifications, loadFormTemplate, form]);
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [form.state.data.printSpecifications]);
|
||||
|
||||
const doSubmit = async (buttonName: string) => {
|
||||
try {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user