TypeError: items.map is not a function in Edit.ts for array resources with files
Describe the bug
Creating a resource of type: 'mixed', isArray: true, isDraggable: true results in an Object rather than an Array when editing an entry and combined with the uploadFeature.
Installed libraries and their versions
"adminjs": "^6.4.1",
"@adminjs/nestjs": "^5.0.1",
"@adminjs/upload": "^3.0.0",
"@adminjs/sequelize": "^3.0.0",
"@nestjs/sequelize": "^9.0.0",
To Reproduce
Resource definition:
featuredRelease: { type: 'mixed', isArray: true, isDraggable: true }, // Note that the same thing happens without isDraggable
'featuredRelease.name': { type: 'string' },
'featuredRelease.file': { type: 'string' },
'featuredRelease.url': { type: 'string' },
'featuredRelease.description': { type: 'richtext' },
Feature definition:
uploadFeature({
provider: { local: { bucket: 'uploads/featured-releases' } },
properties: {
file: `featuredRelease.file`,
filePath: `featuredRelease.filePath`,
filesToDelete: `featuredRelease.filesToDelete`,
key: `featuredRelease.key`,
mimeType: `featuredRelease.mimeType`,
size: `featuredRelease.size`,
},
uploadPath: (record, filename) => {
return `${slugify(record.title())}/${filename}`;
},
}),

-
Edit the resource and add a new value to the array (in this example, a new `featuredRelease).

-
Add a file attachment and observe that the value of
itemsis an array with two keys (which is correct)

-
Add a value into the name field (or any other field) and tab off the field (there doesn't have to be a value in the field) and observe that the value of
itemsis now an object (which is incorrect)
-
The issue happens when there's a value in the file and also a value in one of the other fields.

-
Note that the order seems to make a difference. You need to add the file first to trigger this behaviour. Filling in all of the string fields and then setting the file doesn't error (and looks correct), but saves only the file object (so then rendering the
Showscreen breaks
Expected behavior
The type of items to remain an Array rather than converting to an object when both a File is present with other properties.