@@ -46,9 +46,6 @@ export const baseClass = 'upload'
46
46
type PopulatedDocs = { relationTo : string ; value : JsonObject } [ ]
47
47
48
48
export type UploadInputProps = {
49
- readonly Description ?: MappedComponent
50
- readonly Error ?: MappedComponent
51
- readonly Label ?: MappedComponent
52
49
/**
53
50
* Controls the visibility of the "Create new collection" button
54
51
*/
@@ -57,13 +54,16 @@ export type UploadInputProps = {
57
54
readonly className ?: string
58
55
readonly collection ?: ClientCollectionConfig
59
56
readonly customUploadActions ?: React . ReactNode [ ]
57
+ readonly Description ?: MappedComponent
60
58
readonly description ?: StaticDescription
61
59
readonly descriptionProps ?: FieldDescriptionClientProps < MarkOptional < UploadFieldClient , 'type' > >
60
+ readonly Error ?: MappedComponent
62
61
readonly errorProps ?: FieldErrorClientProps < MarkOptional < UploadFieldClient , 'type' > >
63
62
readonly field ?: MarkOptional < UploadFieldClient , 'type' >
64
63
readonly filterOptions ?: FilterOptionsResult
65
64
readonly hasMany ?: boolean
66
65
readonly isSortable ?: boolean
66
+ readonly Label ?: MappedComponent
67
67
readonly label : StaticLabel
68
68
readonly labelProps ?: FieldLabelClientProps < MarkOptional < UploadFieldClient , 'type' > >
69
69
readonly maxRows ?: number
@@ -81,19 +81,19 @@ export type UploadInputProps = {
81
81
82
82
export function UploadInput ( props : UploadInputProps ) {
83
83
const {
84
- Description,
85
- Error,
86
- Label,
87
84
allowNewUpload,
88
85
api,
89
86
className,
87
+ Description,
90
88
description,
91
89
descriptionProps,
90
+ Error,
92
91
errorProps,
93
92
field,
94
93
filterOptions : filterOptionsFromProps ,
95
94
hasMany,
96
95
isSortable,
96
+ Label,
97
97
label,
98
98
labelProps,
99
99
maxRows,
@@ -181,7 +181,7 @@ export function UploadInput(props: UploadInputProps) {
181
181
async (
182
182
ids : ( number | string ) [ ] ,
183
183
relatedCollectionSlug : string ,
184
- ) : Promise < PaginatedDocs | null > => {
184
+ ) : Promise < null | PaginatedDocs > => {
185
185
const query : {
186
186
[ key : string ] : unknown
187
187
where : Where
@@ -213,7 +213,12 @@ export function UploadInput(props: UploadInputProps) {
213
213
} )
214
214
if ( response . ok ) {
215
215
const json = await response . json ( )
216
- const sortedDocs = ids . map ( ( id ) => json . docs . find ( ( doc ) => doc . id === id ) )
216
+ const sortedDocs = ids . map ( ( id ) =>
217
+ json . docs . find ( ( doc ) => {
218
+ return String ( doc . id ) === String ( id )
219
+ } ) ,
220
+ )
221
+
217
222
return { ...json , docs : sortedDocs }
218
223
}
219
224
0 commit comments