-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ui): thread cache tag to list view thumbnails #11741
base: main
Are you sure you want to change the base?
fix(ui): thread cache tag to list view thumbnails #11741
Conversation
* Check if the fileSrc already has a query string, if it does, append the imageCacheTag with an ampersand | ||
*/ | ||
const queryChar = fileSrc?.includes('?') ? '&' : '?' | ||
return imageCacheTag ? `${fileSrc}${queryChar}${encodeURIComponent(imageCacheTag)}` : fileSrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this will encode false for no reason here? We should first check for the cache tag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @JarrodMFlesch
Thanks for reviewing!
I think if imageCacheTag
is false-y (or straight up false), then this code will fallback to fileSrc
. If no fileSrc
is provided, then it returns early with null
unless I missed something here. Note the ternary operator in the return there. Am I overlooking a case?
Let me know!
* Check if the fileSrc already has a query string, if it does, append the imageCacheTag with an ampersand | ||
*/ | ||
const queryChar = fileSrc?.includes('?') ? '&' : '?' | ||
return imageCacheTag ? `${fileSrc}${queryChar}${encodeURIComponent(imageCacheTag)}` : fileSrc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this will encode false for no reason here? We should first check for the cache tag.
What?
This PR threads a cache tag to the
Thumbnail
component through the defaultFile
cell in the list view if cache tags are enabled in upload config. These changes also adjust theThumbnail
component to useuseMemo
instead of constructing asrc
later due to:The above causes an extra request to be made if cache tags are enabled.
Why?
To thread cache tags through to the list view thumbnails.
How?
Changes the default
File
cell to pass the cache tag through if enabled, and changing a failing test to accommodate cache tags in the list view.Addresses cache tag issue in #11690