Fix company document removal in edit mode
continuous-integration/drone/push Build is passing

This commit is contained in:
AmirReza Jamali
2026-07-07 10:54:51 +03:30
parent 98fac2c867
commit 08938ad7f0
6 changed files with 116 additions and 39 deletions
@@ -25,6 +25,7 @@ interface CompanyFormSectionsOptions {
categoryItems: ILabelValue[];
watch: UseFormWatch<ICreateCompanyCredentials>;
setValue: UseFormSetValue<ICreateCompanyCredentials>;
persistDocumentFileIds?: (ids: string[]) => Promise<void>;
}
const optionalNumber = (value: unknown) => {
@@ -240,6 +241,7 @@ export const createCompanyFormSections = ({
categoryItems,
watch,
setValue,
persistDocumentFileIds,
}: CompanyFormSectionsOptions): DynamicFormSection<ICreateCompanyCredentials>[] => [
{
id: companyInformationSectionId,
@@ -652,7 +654,14 @@ export const createCompanyFormSections = ({
<CompanyDocuments
companyId={editMode ? id : undefined}
value={watch("document_file_ids") ?? []}
onChange={(ids) => setValue("document_file_ids", ids)}
onChange={(ids) =>
setValue("document_file_ids", ids, {
shouldDirty: true,
shouldTouch: true,
shouldValidate: true,
})
}
onRemovePersist={persistDocumentFileIds}
/>
),
},