From aeba8d02c54c5c97579b0702fd0c03239ed40452 Mon Sep 17 00:00:00 2001 From: Sam Becker Date: Wed, 8 May 2024 11:36:20 -0500 Subject: [PATCH] Separate PPR from static optimization --- README.md | 2 +- next.config.js | 10 --- package.json | 2 +- pnpm-lock.yaml | 123 +++++++++++++++------------- src/app/loading.tsx | 1 - src/app/p/[photoId]/image/route.tsx | 3 +- src/app/p/[photoId]/layout.tsx | 3 +- src/auth/cache.ts | 4 +- src/photo/db.ts | 4 +- src/photo/index.ts | 2 - src/services/storage/index.ts | 7 +- src/site/SiteChecklistClient.tsx | 4 +- src/utility/ppr.ts | 21 ----- 13 files changed, 76 insertions(+), 110 deletions(-) delete mode 100644 src/app/loading.tsx delete mode 100644 src/utility/ppr.ts diff --git a/README.md b/README.md index 857594d3..35fe9df4 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ _⚠️ READ BEFORE PROCEEDING_ Application behavior can be changed by configuring the following environment variables: - `NEXT_PUBLIC_PRO_MODE = 1` enables higher quality image storage (results in increased storage usage) -- `NEXT_PUBLIC_STATICALLY_OPTIMIZE = 1` enables PPR and static optimization, i.e., building pages ahead of time (results in increased storage usage)—⚠️ _Experimental_ +- `NEXT_PUBLIC_STATICALLY_OPTIMIZE = 1` enables static optimization, i.e., renders pages and images at build time (results in increased project usage)—⚠️ _Experimental_ - `NEXT_PUBLIC_BLUR_DISABLED = 1` prevents image blur data being stored and displayed (potentially useful for limiting Postgres usage) - `NEXT_PUBLIC_GEO_PRIVACY = 1` disables collection/display of location-based data - `NEXT_PUBLIC_IGNORE_PRIORITY_ORDER = 1` prevents `priority_order` field affecting photo order diff --git a/next.config.js b/next.config.js index 4520e734..f0ff1b30 100644 --- a/next.config.js +++ b/next.config.js @@ -35,16 +35,6 @@ const nextConfig = { .concat(createRemotePattern(HOSTNAME_AWS_S3)), minimumCacheTTL: 31536000, }, - ...process.env.NEXT_PUBLIC_STATICALLY_OPTIMIZE === '1' && { - experimental: { ppr: true }, - }, - webpack: (config) => { - config.optimization ??= {}; - if (process.env.NODE_ENV !== 'production') { - config.optimization.minimize = false; - } - return config; - }, }; const withBundleAnalyzer = require('@next/bundle-analyzer')({ diff --git a/package.json b/package.json index 8a0d7541..36948280 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "nanoid": "^5.0.7", - "next": "14.3.0-canary.44", + "next": "^14.2.3", "next-auth": "5.0.0-beta.15", "next-themes": "^0.3.0", "openai": "^4.38.5", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 86345a66..60a7bd31 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,7 +58,7 @@ importers: version: 1.1.3 '@vercel/analytics': specifier: ^1.2.2 - version: 1.2.2(next@14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) + version: 1.2.2(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) '@vercel/blob': specifier: ^0.23.2 version: 0.23.2 @@ -67,7 +67,7 @@ importers: version: 1.0.1 '@vercel/speed-insights': specifier: ^1.0.10 - version: 1.0.10(next@14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(svelte@4.2.15)(vue@3.4.25(typescript@5.4.5)) + version: 1.0.10(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(svelte@4.2.15)(vue@3.4.25(typescript@5.4.5)) ai: specifier: ^3.0.34 version: 3.0.34(react@18.3.1)(solid-js@1.8.17)(svelte@4.2.15)(vue@3.4.25(typescript@5.4.5))(zod@3.23.4) @@ -108,11 +108,11 @@ importers: specifier: ^5.0.7 version: 5.0.7 next: - specifier: 14.3.0-canary.44 - version: 14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + specifier: ^14.2.3 + version: 14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) next-auth: specifier: 5.0.0-beta.15 - version: 5.0.0-beta.15(next@14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) + version: 5.0.0-beta.15(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1) next-themes: specifier: ^0.3.0 version: 0.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) @@ -809,62 +809,62 @@ packages: '@next/bundle-analyzer@14.2.3': resolution: {integrity: sha512-Z88hbbngMs7njZKI8kTJIlpdLKYfMSLwnsqYe54AP4aLmgL70/Ynx/J201DQ+q2Lr6FxFw1uCeLGImDrHOl2ZA==} - '@next/env@14.3.0-canary.44': - resolution: {integrity: sha512-n7E0UKB5tAcEEVO9iLuWVdx5nf+39GEHBo4mrRrC9zqXdP9Jxve4nFWFeDTU5EBSzuH3Zy4DmoVNHUOspHLmyQ==} + '@next/env@14.2.3': + resolution: {integrity: sha512-W7fd7IbkfmeeY2gXrzJYDx8D2lWKbVoTIj1o1ScPHNzvp30s1AuoEFSdr39bC5sjxJaxTtq3OTCZboNp0lNWHA==} '@next/eslint-plugin-next@14.2.3': resolution: {integrity: sha512-L3oDricIIjgj1AVnRdRor21gI7mShlSwU/1ZGHmqM3LzHhXXhdkrfeNY5zif25Bi5Dd7fiJHsbhoZCHfXYvlAw==} - '@next/swc-darwin-arm64@14.3.0-canary.44': - resolution: {integrity: sha512-gooP4KXsw3DDZAlvjEJNyQsSacwPRJJ5f5wkrws1J17L/heUgZHX6G7vHnQgkAejyvfa5BhW2c9rlcPxOHNQqw==} + '@next/swc-darwin-arm64@14.2.3': + resolution: {integrity: sha512-3pEYo/RaGqPP0YzwnlmPN2puaF2WMLM3apt5jLW2fFdXD9+pqcoTzRk+iZsf8ta7+quAe4Q6Ms0nR0SFGFdS1A==} engines: {node: '>= 10'} cpu: [arm64] os: [darwin] - '@next/swc-darwin-x64@14.3.0-canary.44': - resolution: {integrity: sha512-NbtsRFYzs8sU2VCMzqGjb4tdzhkQt1KcMB/ZqnHX5pPw5xtXqPXzBGLM0z3wHr5/vWlL4V22j8E7AGchE2TeXg==} + '@next/swc-darwin-x64@14.2.3': + resolution: {integrity: sha512-6adp7waE6P1TYFSXpY366xwsOnEXM+y1kgRpjSRVI2CBDOcbRjsJ67Z6EgKIqWIue52d2q/Mx8g9MszARj8IEA==} engines: {node: '>= 10'} cpu: [x64] os: [darwin] - '@next/swc-linux-arm64-gnu@14.3.0-canary.44': - resolution: {integrity: sha512-ctGyGeHy/07TH82ZYuA74Xy0t8Zcq1xrMLTI9RUA8Dh4khf37RI7r9SHzAeqKmPGZJAPRyE6pwXtAlCg/TstjA==} + '@next/swc-linux-arm64-gnu@14.2.3': + resolution: {integrity: sha512-cuzCE/1G0ZSnTAHJPUT1rPgQx1w5tzSX7POXSLaS7w2nIUJUD+e25QoXD/hMfxbsT9rslEXugWypJMILBj/QsA==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-arm64-musl@14.3.0-canary.44': - resolution: {integrity: sha512-cX/jD3EnhIphZwRBureGSPV4GlQ7ueUKmne+5N2BsO6tHih0cnveyssropX1dTupU7aGti+22kPorPDY7BYNfQ==} + '@next/swc-linux-arm64-musl@14.2.3': + resolution: {integrity: sha512-0D4/oMM2Y9Ta3nGuCcQN8jjJjmDPYpHX9OJzqk42NZGJocU2MqhBq5tWkJrUQOQY9N+In9xOdymzapM09GeiZw==} engines: {node: '>= 10'} cpu: [arm64] os: [linux] - '@next/swc-linux-x64-gnu@14.3.0-canary.44': - resolution: {integrity: sha512-2HPcwOxXBQj3WD5ezz78o/SJXXz9D4U5H7Mc4e0cTUMy/GGW4ysg2Ullwus+FVOmm2z8GAcNbEeqh71D/lAtww==} + '@next/swc-linux-x64-gnu@14.2.3': + resolution: {integrity: sha512-ENPiNnBNDInBLyUU5ii8PMQh+4XLr4pG51tOp6aJ9xqFQ2iRI6IH0Ds2yJkAzNV1CfyagcyzPfROMViS2wOZ9w==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-linux-x64-musl@14.3.0-canary.44': - resolution: {integrity: sha512-UV9HUQenKZkrqbhRsB59X5KrMKaPUnXkbZmwLkjD2IieUgm5CswfXJ2+7JneopviwaR3k8eJMA2KV9uyA/3LpQ==} + '@next/swc-linux-x64-musl@14.2.3': + resolution: {integrity: sha512-BTAbq0LnCbF5MtoM7I/9UeUu/8ZBY0i8SFjUMCbPDOLv+un67e2JgyN4pmgfXBwy/I+RHu8q+k+MCkDN6P9ViQ==} engines: {node: '>= 10'} cpu: [x64] os: [linux] - '@next/swc-win32-arm64-msvc@14.3.0-canary.44': - resolution: {integrity: sha512-Swrl7I7q4sw7iS6O2j5v/c5bLgHP+i4/z79XTzU2LDubMP7gL3eUqLhN1GAOO35q/j49Ysbsr3VUM14JCtGOkg==} + '@next/swc-win32-arm64-msvc@14.2.3': + resolution: {integrity: sha512-AEHIw/dhAMLNFJFJIJIyOFDzrzI5bAjI9J26gbO5xhAKHYTZ9Or04BesFPXiAYXDNdrwTP2dQceYA4dL1geu8A==} engines: {node: '>= 10'} cpu: [arm64] os: [win32] - '@next/swc-win32-ia32-msvc@14.3.0-canary.44': - resolution: {integrity: sha512-3KKbNG6EDMpAY9PP/Bv32ildjljC9vUwRbLrhBLa6l3TkD6n8xtlObNf9DMD0Fsa79VKHZKIkY1EvCn/7xlj5A==} + '@next/swc-win32-ia32-msvc@14.2.3': + resolution: {integrity: sha512-vga40n1q6aYb0CLrM+eEmisfKCR45ixQYXuBXxOOmmoV8sYST9k7E3US32FsY+CkkF7NtzdcebiFT4CHuMSyZw==} engines: {node: '>= 10'} cpu: [ia32] os: [win32] - '@next/swc-win32-x64-msvc@14.3.0-canary.44': - resolution: {integrity: sha512-pDD9g/tTI/ihOP4c8wy5E0dRz8QUy2/7uAVyW11MIkroA4A4/cWa58PQNW5ByhvySPTcf9trnlaVPa2mdxBMMA==} + '@next/swc-win32-x64-msvc@14.2.3': + resolution: {integrity: sha512-Q1/zm43RWynxrO7lW4ehciQVj+5ePBhOK+/K2P7pLFX3JaJ/IZVC69SHidrmZSOkqz7ECIOhhy7XhAFG4JYyHA==} engines: {node: '>= 10'} cpu: [x64] os: [win32] @@ -1364,8 +1364,11 @@ packages: resolution: {integrity: sha512-IHk53BVw6MPMi2Gsn+hCng8rFA3ZmR3Rk7GllxDUW9qFJl/hiSvskn7XldkECapQVkIg/1dHpMAxI9xSTaLLSA==} engines: {node: '>=14.0.0'} - '@swc/helpers@0.5.11': - resolution: {integrity: sha512-YNlnKRWF2sVojTpIyzwou9XoTNbzbzONwRhOoniEioF1AtaitTvVZblaQRrAzChWQ1bLYyYSWzM18y4WwgzJ+A==} + '@swc/counter@0.1.3': + resolution: {integrity: sha512-e2BR4lsJkkRlKZ/qCHPw9ZaSxc0MVUd7gtbtaB7aMvHeJVYe8sOB8DBZkP2DtISHGSku9sCK6T6cnY0CtXrOCQ==} + + '@swc/helpers@0.5.5': + resolution: {integrity: sha512-KGYxvIOXcceOAbEk4bi/dVLEK9z8sZ0uBB3Il5b1rhfClSpcX0yfRO0KmTkqR2cnQDymwLB+25ZyMzICg/cm/A==} '@tailwindcss/container-queries@0.1.1': resolution: {integrity: sha512-p18dswChx6WnTSaJCSGx6lTmrGzNNvm2FtXmiO6AuA1V4U5REyoqwmT6kgAsIMdjo07QdAfYXHJ4hnMtfHzWgA==} @@ -3259,8 +3262,8 @@ packages: react: ^16.8 || ^17 || ^18 react-dom: ^16.8 || ^17 || ^18 - next@14.3.0-canary.44: - resolution: {integrity: sha512-iYJmuiARcldXjN27N0Yo8gWyy6vWl+FoUNcEaL2GGh3sA/rc4hcbZD89ZUXoVFsPAI7ze6sKM60Znct9RwCbKQ==} + next@14.2.3: + resolution: {integrity: sha512-dowFkFTR8v79NPJO4QsBUtxv0g9BrS/phluVpMAt2ku7H+cbcBJlopXjkWlwxrk/xGqMemr7JkGPGemPrLLX7A==} engines: {node: '>=18.17.0'} hasBin: true peerDependencies: @@ -5452,37 +5455,37 @@ snapshots: - bufferutil - utf-8-validate - '@next/env@14.3.0-canary.44': {} + '@next/env@14.2.3': {} '@next/eslint-plugin-next@14.2.3': dependencies: glob: 10.3.10 - '@next/swc-darwin-arm64@14.3.0-canary.44': + '@next/swc-darwin-arm64@14.2.3': optional: true - '@next/swc-darwin-x64@14.3.0-canary.44': + '@next/swc-darwin-x64@14.2.3': optional: true - '@next/swc-linux-arm64-gnu@14.3.0-canary.44': + '@next/swc-linux-arm64-gnu@14.2.3': optional: true - '@next/swc-linux-arm64-musl@14.3.0-canary.44': + '@next/swc-linux-arm64-musl@14.2.3': optional: true - '@next/swc-linux-x64-gnu@14.3.0-canary.44': + '@next/swc-linux-x64-gnu@14.2.3': optional: true - '@next/swc-linux-x64-musl@14.3.0-canary.44': + '@next/swc-linux-x64-musl@14.2.3': optional: true - '@next/swc-win32-arm64-msvc@14.3.0-canary.44': + '@next/swc-win32-arm64-msvc@14.2.3': optional: true - '@next/swc-win32-ia32-msvc@14.3.0-canary.44': + '@next/swc-win32-ia32-msvc@14.2.3': optional: true - '@next/swc-win32-x64-msvc@14.3.0-canary.44': + '@next/swc-win32-x64-msvc@14.2.3': optional: true '@nodelib/fs.scandir@2.1.5': @@ -6111,8 +6114,11 @@ snapshots: '@smithy/types': 2.12.0 tslib: 2.6.2 - '@swc/helpers@0.5.11': + '@swc/counter@0.1.3': {} + + '@swc/helpers@0.5.5': dependencies: + '@swc/counter': 0.1.3 tslib: 2.6.2 '@tailwindcss/container-queries@0.1.1(tailwindcss@3.4.3)': @@ -6404,11 +6410,11 @@ snapshots: dependencies: crypto-js: 4.2.0 - '@vercel/analytics@1.2.2(next@14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)': + '@vercel/analytics@1.2.2(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)': dependencies: server-only: 0.0.1 optionalDependencies: - next: 14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + next: 14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: 18.3.1 '@vercel/blob@0.23.2': @@ -6422,9 +6428,9 @@ snapshots: dependencies: '@upstash/redis': 1.25.1 - '@vercel/speed-insights@1.0.10(next@14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(svelte@4.2.15)(vue@3.4.25(typescript@5.4.5))': + '@vercel/speed-insights@1.0.10(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1)(svelte@4.2.15)(vue@3.4.25(typescript@5.4.5))': optionalDependencies: - next: 14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + next: 14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: 18.3.1 svelte: 4.2.15 vue: 3.4.25(typescript@5.4.5) @@ -8407,10 +8413,10 @@ snapshots: natural-compare@1.4.0: {} - next-auth@5.0.0-beta.15(next@14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1): + next-auth@5.0.0-beta.15(next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1))(react@18.3.1): dependencies: '@auth/core': 0.28.0 - next: 14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + next: 14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) react: 18.3.1 next-themes@0.3.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): @@ -8418,10 +8424,10 @@ snapshots: react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - next@14.3.0-canary.44(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + next@14.2.3(@babel/core@7.24.4)(react-dom@18.3.1(react@18.3.1))(react@18.3.1): dependencies: - '@next/env': 14.3.0-canary.44 - '@swc/helpers': 0.5.11 + '@next/env': 14.2.3 + '@swc/helpers': 0.5.5 busboy: 1.6.0 caniuse-lite: 1.0.30001612 graceful-fs: 4.2.11 @@ -8430,16 +8436,15 @@ snapshots: react-dom: 18.3.1(react@18.3.1) styled-jsx: 5.1.1(@babel/core@7.24.4)(react@18.3.1) optionalDependencies: - '@next/swc-darwin-arm64': 14.3.0-canary.44 - '@next/swc-darwin-x64': 14.3.0-canary.44 - '@next/swc-linux-arm64-gnu': 14.3.0-canary.44 - '@next/swc-linux-arm64-musl': 14.3.0-canary.44 - '@next/swc-linux-x64-gnu': 14.3.0-canary.44 - '@next/swc-linux-x64-musl': 14.3.0-canary.44 - '@next/swc-win32-arm64-msvc': 14.3.0-canary.44 - '@next/swc-win32-ia32-msvc': 14.3.0-canary.44 - '@next/swc-win32-x64-msvc': 14.3.0-canary.44 - sharp: 0.33.3 + '@next/swc-darwin-arm64': 14.2.3 + '@next/swc-darwin-x64': 14.2.3 + '@next/swc-linux-arm64-gnu': 14.2.3 + '@next/swc-linux-arm64-musl': 14.2.3 + '@next/swc-linux-x64-gnu': 14.2.3 + '@next/swc-linux-x64-musl': 14.2.3 + '@next/swc-win32-arm64-msvc': 14.2.3 + '@next/swc-win32-ia32-msvc': 14.2.3 + '@next/swc-win32-x64-msvc': 14.2.3 transitivePeerDependencies: - '@babel/core' - babel-plugin-macros diff --git a/src/app/loading.tsx b/src/app/loading.tsx deleted file mode 100644 index 1ae6b757..00000000 --- a/src/app/loading.tsx +++ /dev/null @@ -1 +0,0 @@ -export { default } from '@/components/PageSpinner'; diff --git a/src/app/p/[photoId]/image/route.tsx b/src/app/p/[photoId]/image/route.tsx index af686752..2e87c567 100644 --- a/src/app/p/[photoId]/image/route.tsx +++ b/src/app/p/[photoId]/image/route.tsx @@ -5,8 +5,7 @@ import { getIBMPlexMonoMedium } from '@/site/font'; import { ImageResponse } from 'next/og'; import { getImageResponseCacheControlHeaders } from '@/image-response/cache'; import { STATICALLY_OPTIMIZED } from '@/site/config'; -import { getPhotoIds } from '@/photo/db'; -import { GENERATE_STATIC_PARAMS_LIMIT } from '@/photo'; +import { GENERATE_STATIC_PARAMS_LIMIT, getPhotoIds } from '@/photo/db'; export let generateStaticParams: (() => Promise<{ photoId: string }[]>) | undefined = undefined; diff --git a/src/app/p/[photoId]/layout.tsx b/src/app/p/[photoId]/layout.tsx index de54ef41..e4c0c630 100644 --- a/src/app/p/[photoId]/layout.tsx +++ b/src/app/p/[photoId]/layout.tsx @@ -1,5 +1,4 @@ import { - GENERATE_STATIC_PARAMS_LIMIT, GRID_THUMBNAILS_TO_SHOW_MAX, descriptionForPhoto, titleForPhoto, @@ -14,7 +13,7 @@ import { import PhotoDetailPage from '@/photo/PhotoDetailPage'; import { getPhotosNearIdCachedCached } from '@/photo/cache'; import { STATICALLY_OPTIMIZED } from '@/site/config'; -import { getPhotoIds } from '@/photo/db'; +import { GENERATE_STATIC_PARAMS_LIMIT, getPhotoIds } from '@/photo/db'; export let generateStaticParams: (() => Promise<{ photoId: string }[]>) | undefined = undefined; diff --git a/src/auth/cache.ts b/src/auth/cache.ts index 84ac9f5d..e1079046 100644 --- a/src/auth/cache.ts +++ b/src/auth/cache.ts @@ -1,6 +1,4 @@ import { cache } from 'react'; import { auth } from '@/auth'; -import { screenForPPR } from '@/utility/ppr'; -export const authCachedSafe = cache(() => auth() - .catch(e => screenForPPR(e, null, 'auth'))); +export const authCachedSafe = cache(() => auth().catch(() => null)); diff --git a/src/photo/db.ts b/src/photo/db.ts index 49e4ffb4..7bca89f7 100644 --- a/src/photo/db.ts +++ b/src/photo/db.ts @@ -16,7 +16,8 @@ import { parameterize } from '@/utility/string'; import { TagsWithMeta } from '@/tag'; import { FilmSimulation, FilmSimulations } from '@/simulation'; import { SHOULD_DEBUG_SQL, PRIORITY_ORDER_ENABLED } from '@/site/config'; -import { screenForPPR } from '@/utility/ppr'; + +export const GENERATE_STATIC_PARAMS_LIMIT = 1000; const PHOTO_DEFAULT_LIMIT = 100; @@ -310,7 +311,6 @@ const safelyQueryPhotos = async ( try { result = await callback(); } catch (e: any) { - screenForPPR(e, undefined, 'neon postgres'); if (MIGRATION_FIELDS_01.some(field => new RegExp( `column "${field}" of relation "photos" does not exist`, 'i', diff --git a/src/photo/index.ts b/src/photo/index.ts index 122b5b63..903fb8bd 100644 --- a/src/photo/index.ts +++ b/src/photo/index.ts @@ -14,8 +14,6 @@ import camelcaseKeys from 'camelcase-keys'; import { isBefore } from 'date-fns'; import type { Metadata } from 'next'; -export const GENERATE_STATIC_PARAMS_LIMIT = 1000; - // ROOT PAGE export const INFINITE_SCROLL_INITIAL_HOME = process.env.NODE_ENV === 'development' ? 2 : 12; diff --git a/src/services/storage/index.ts b/src/services/storage/index.ts index 2a37576c..0f3e008e 100644 --- a/src/services/storage/index.ts +++ b/src/services/storage/index.ts @@ -27,7 +27,6 @@ import { isUrlFromCloudflareR2, } from './cloudflare-r2'; import { PATH_API_PRESIGNED_URL } from '@/site/paths'; -import { screenForPPR } from '@/utility/ppr'; export const generateStorageId = () => generateNanoid(16); @@ -193,15 +192,15 @@ const getStorageUrlsForPrefix = async (prefix = '') => { if (HAS_VERCEL_BLOB_STORAGE) { urls.push(...await vercelBlobList(prefix) - .catch(e => screenForPPR(e, [], 'vercel blob'))); + .catch(() => [])); } if (HAS_AWS_S3_STORAGE) { urls.push(...await awsS3List(prefix) - .catch(e => screenForPPR(e, [], 'aws blob'))); + .catch(() => [])); } if (HAS_CLOUDFLARE_R2_STORAGE) { urls.push(...await cloudflareR2List(prefix) - .catch(e => screenForPPR(e, [], 'cloudflare blob'))); + .catch(() => [])); } return urls diff --git a/src/site/SiteChecklistClient.tsx b/src/site/SiteChecklistClient.tsx index 7e6ea602..5201a3fc 100644 --- a/src/site/SiteChecklistClient.tsx +++ b/src/site/SiteChecklistClient.tsx @@ -358,8 +358,8 @@ export default function SiteChecklistClient({ optional experimental > - Set environment variable to {'"1"'} to enable PPR - and static optimization, i.e., build pages ahead of time: + Set environment variable to {'"1"'} to enable static optimization, + i.e., rendering pages and images at build time: {renderEnvVars(['NEXT_PUBLIC_STATICALLY_OPTIMIZE'])} ( - error: any, - fallback: T, - sourceToLog?: string, - debug?: boolean -): T => { - // PPR errors, if caught, must be re-thrown in order to - // postpone rendering - if (error.sourceError?.message?.includes('ppr-caught-error')) { - if (debug) { - console.log(`${sourceToLog}: throwing error.sourceError`); - } - throw error.sourceError; - } else if (error.message?.includes('ppr-caught-error')) { - if (debug) { - console.log(`${sourceToLog}: throwing error`); - } - throw error; - } - return fallback; -};