fix(ui): apply cacheTags upload config property to other admin panel image components (#10801)

In https://github.com/payloadcms/payload/pull/10319, the `cacheTags`
property was added to the image config. This achieves the goal as
described, however, there are still other places where this issue
occurs, which should be handled in the same way. This PR aims to apply
it to those instances.
This commit is contained in:
Simon Vreman
2025-02-06 12:04:03 +01:00
committed by GitHub
parent d8cfdc7bcb
commit e29ac523d3

View File

@@ -268,6 +268,8 @@ export const Upload: React.FC<UploadProps> = (props) => {
const acceptMimeTypes = uploadConfig.mimeTypes?.join(', ') const acceptMimeTypes = uploadConfig.mimeTypes?.join(', ')
const imageCacheTag = uploadConfig?.cacheTags && savedDocumentData?.updatedAt
return ( return (
<div className={[fieldBaseClass, baseClass].filter(Boolean).join(' ')}> <div className={[fieldBaseClass, baseClass].filter(Boolean).join(' ')}>
<FieldError message={errorMessage} showError={showError} /> <FieldError message={errorMessage} showError={showError} />
@@ -279,7 +281,7 @@ export const Upload: React.FC<UploadProps> = (props) => {
enableAdjustments={showCrop || showFocalPoint} enableAdjustments={showCrop || showFocalPoint}
handleRemove={canRemoveUpload ? handleFileRemoval : undefined} handleRemove={canRemoveUpload ? handleFileRemoval : undefined}
hasImageSizes={hasImageSizes} hasImageSizes={hasImageSizes}
imageCacheTag={uploadConfig?.cacheTags && savedDocumentData.updatedAt} imageCacheTag={imageCacheTag}
uploadConfig={uploadConfig} uploadConfig={uploadConfig}
/> />
)} )}
@@ -415,7 +417,7 @@ export const Upload: React.FC<UploadProps> = (props) => {
<EditUpload <EditUpload
fileName={value?.name || savedDocumentData?.filename} fileName={value?.name || savedDocumentData?.filename}
fileSrc={savedDocumentData?.url || fileSrc} fileSrc={savedDocumentData?.url || fileSrc}
imageCacheTag={savedDocumentData?.updatedAt} imageCacheTag={imageCacheTag}
initialCrop={uploadEdits?.crop ?? undefined} initialCrop={uploadEdits?.crop ?? undefined}
initialFocalPoint={{ initialFocalPoint={{
x: uploadEdits?.focalPoint?.x || savedDocumentData?.focalX || 50, x: uploadEdits?.focalPoint?.x || savedDocumentData?.focalX || 50,
@@ -437,7 +439,7 @@ export const Upload: React.FC<UploadProps> = (props) => {
> >
<PreviewSizes <PreviewSizes
doc={savedDocumentData} doc={savedDocumentData}
imageCacheTag={savedDocumentData.updatedAt} imageCacheTag={imageCacheTag}
uploadConfig={uploadConfig} uploadConfig={uploadConfig}
/> />
</Drawer> </Drawer>