mirror of
https://github.com/simstudioai/sim.git
synced 2026-09-24 15:45:35 +08:00
fix(images): fix stale images (#5462)
* fix(images): fix stale images * Fix comment
This commit is contained in:
@@ -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'>
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user