Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

wip: add cache control for next/image

Marc Seitz93f555eed1fc
diff --git a/components/view/document-view.tsx b/components/view/document-view.tsx
index a1e27c5b..dc32e27f 100644
--- a/components/view/document-view.tsx
+++ b/components/view/document-view.tsx
@@ -132,6 +132,10 @@ export default function DocumentView({
handleSubmission();
}
+ if (viewData.viewId === "") {
+ return <LoadingSpinner className="mr-1 h-5 w-5" />;
+ }
+
return (
<div className="bg-gray-950">
{viewData.pages ? (
diff --git a/next.config.js b/next.config.js
index 20cefbf0..6f99cd04 100644
--- a/next.config.js
+++ b/next.config.js
@@ -13,6 +13,7 @@ const nextConfig = {
"localhost", // local img
"36so9a8uzykxknsu.public.blob.vercel-storage.com", // staging img
"yoywvlh29jppecbh.public.blob.vercel-storage.com", // production img
+ "36so9a8uzykxknsu.public.blob.vercel-storage.com", // staging img
],
},
experimental: {
@@ -20,6 +21,20 @@ const nextConfig = {
"/api/mupdf/*": ["./node_modules/mupdf/lib/*.wasm"],
},
},
+ async headers() {
+ return [
+ {
+ // Matching all image types from the Next.js image optimizer
+ source: "/_next/image(.*)",
+ headers: [
+ {
+ key: "Cache-Control",
+ value: "max-age=0, s-maxage=86400",
+ },
+ ],
+ },
+ ];
+ },
};
module.exports = nextConfig