apps/web: fix files map key

This commit is contained in:
vchikalkin 2023-11-30 11:55:27 +03:00
parent 55372c01b7
commit 2ff3589715

View File

@ -33,7 +33,7 @@ type FileProps = {
function File({ document }: FileProps) {
const { formFiles, setFormFiles } = useContext(FormContext);
const { documentTypeId, name } = document;
const { documentId, documentTypeId, name } = document;
const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
if (event.target.files !== null) {
@ -47,7 +47,7 @@ function File({ document }: FileProps) {
};
return (
<div key={documentTypeId} className="flex flex-col gap-1">
<div key={documentId} className="flex flex-col gap-1">
<label className="mb-2 block text-sm font-normal text-gray-900">{name}:</label>
<InputFile onChange={handleFileChange} />
<DownloadDocument document={document} />
@ -61,7 +61,7 @@ export function Files({ documents }: Props) {
<Heading className="text-sms">Документы</Heading>
<div className="grid grid-cols-2 gap-2">
{documents.map((document) => (
<File key={document.documentTypeId} document={document} />
<File key={document.documentId} document={document} />
))}
</div>
</div>