File tree 4 files changed +9
-6
lines changed
Table/DefaultCell/fields/File
4 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import { useModal } from '@faceless-ui/modal'
4
4
import { useWindowInfo } from '@faceless-ui/window-info'
5
- import { isImage } from 'payload/shared'
6
5
import React from 'react'
7
6
import AnimateHeightImport from 'react-animate-height'
8
7
@@ -157,7 +156,8 @@ export function FileSidebar() {
157
156
>
158
157
< Thumbnail
159
158
className = { `${ baseClass } __thumbnail` }
160
- fileSrc = { isImage ( currentFile . type ) ? thumbnailUrls [ index ] : undefined }
159
+ fileSrc = { thumbnailUrls [ index ] }
160
+ key = { thumbnailUrls [ index ] }
161
161
/>
162
162
< div className = { `${ baseClass } __fileDetails` } >
163
163
< p className = { `${ baseClass } __fileName` } title = { currentFile . name } >
Original file line number Diff line number Diff line change @@ -117,8 +117,7 @@ export function FormsManagerProvider({ children }: FormsManagerProps) {
117
117
processedFiles . current . add ( file )
118
118
119
119
// Generate thumbnail and update ref
120
- const thumbnailUrl = await createThumbnail ( file )
121
- newThumbnails [ i ] = thumbnailUrl
120
+ newThumbnails [ i ] = await createThumbnail ( file , null , file . type )
122
121
thumbnailUrlsRef . current = newThumbnails
123
122
124
123
// Trigger re-render in batches
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ export const FileCell: React.FC<FileCellProps> = ({
16
16
rowData,
17
17
} ) => {
18
18
const { collectionSlug, uploadConfig } = customCellContext
19
+ const src = rowData ?. thumbnailURL || rowData ?. url
19
20
20
21
return (
21
22
< div className = { baseClass } >
@@ -26,7 +27,8 @@ export const FileCell: React.FC<FileCellProps> = ({
26
27
...rowData ,
27
28
filename,
28
29
} }
29
- fileSrc = { rowData ?. thumbnailURL || rowData ?. url }
30
+ fileSrc = { src }
31
+ key = { src }
30
32
size = "small"
31
33
uploadConfig = { uploadConfig }
32
34
/>
Original file line number Diff line number Diff line change @@ -326,7 +326,9 @@ export const Upload: React.FC<UploadProps> = (props) => {
326
326
< div className = { `${ baseClass } __thumbnail-wrap` } >
327
327
< Thumbnail
328
328
collectionSlug = { collectionSlug }
329
- fileSrc = { isImage ( value . type ) ? fileSrc : null }
329
+ doc = { { mimeType : value . type } }
330
+ fileSrc = { fileSrc }
331
+ key = { fileSrc }
330
332
/>
331
333
</ div >
332
334
< div className = { `${ baseClass } __file-adjustments` } >
You can’t perform that action at this time.
0 commit comments