fix(images): fix stale images (#5462)

* fix(images): fix stale images

* Fix comment
This commit is contained in:
Siddharth Ganesan
2026-07-06 18:58:26 -07:00
committed by GitHub
parent e9a922d346
commit 11be2a3167
2 changed files with 6 additions and 2 deletions
@@ -7,7 +7,11 @@ import { ZoomablePreview } from './zoomable-preview'
export const ImagePreview = memo(function ImagePreview({ file }: { file: WorkspaceFileRecord }) {
const source = useFileContentSource()
const serveUrl = source.buildUrl(file.key)
// Version the URL on updatedAt: overwrites keep the same storage key, so an unversioned
// URL would resolve to a previously cached copy instead of the rewritten bytes.
const serveUrl = source.buildUrl(file.key, {
version: Number(new Date(file.updatedAt)) || file.size,
})
return (
<ZoomablePreview className='flex flex-1' contentClassName='h-full w-full'>
+1 -1
View File
@@ -177,7 +177,7 @@ const nextConfig: NextConfig = {
async headers() {
return [
{
source: '/:all*(svg|jpg|jpeg|png|gif|ico|webp|avif|woff|woff2|ttf|eot)',
source: '/((?!api/).*\\.(?:svg|jpg|jpeg|png|gif|ico|webp|avif|woff|woff2|ttf|eot))',
headers: [
{
key: 'Cache-Control',