From f29433a91be7177bd46e092c4fed57186490c116 Mon Sep 17 00:00:00 2001 From: 134 Date: Mon, 13 Jul 2026 16:48:47 +0800 Subject: [PATCH] fix: prevent stale Pascal chunk failures --- deploy/nginx/pascal-service.conf.template | 12 +++++++----- .../apps/editor/app/client-bootstrap.tsx | 9 +-------- services/pascal-editor/apps/editor/package.json | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/deploy/nginx/pascal-service.conf.template b/deploy/nginx/pascal-service.conf.template index 2eef778be..b221a8f21 100644 --- a/deploy/nginx/pascal-service.conf.template +++ b/deploy/nginx/pascal-service.conf.template @@ -17,18 +17,20 @@ location = __PASCAL_BASE_PATH__ { return 302 __PASCAL_BASE_PATH__/scenes; } -# Versioned application chunks and bundled public assets contain no user data. -# Serving them without an auth subrequest prevents an expired/rotating session -# from turning a harmless static request into an Nginx 500 response. +# Production uses Webpack content-hashed chunk names, so changed assets always +# receive a new URL and can be cached immutably without crossing deployments. +# Static assets contain no user data and need no auth subrequest. location ^~ __PASCAL_BASE_PATH__/_next/static/ { proxy_pass http://__PASCAL_NGINX_UPSTREAM__; proxy_http_version 1.1; proxy_hide_header X-Powered-By; + proxy_hide_header Cache-Control; + proxy_hide_header Expires; proxy_set_header Host $host; proxy_set_header Connection ""; proxy_buffering on; - expires 7d; - add_header Cache-Control "public, max-age=604800, immutable" always; + expires 1y; + add_header Cache-Control "public, max-age=31536000, immutable" always; } location ^~ __PASCAL_BASE_PATH__/icons/ { diff --git a/services/pascal-editor/apps/editor/app/client-bootstrap.tsx b/services/pascal-editor/apps/editor/app/client-bootstrap.tsx index 610eac4e6..cc0bdda3b 100644 --- a/services/pascal-editor/apps/editor/app/client-bootstrap.tsx +++ b/services/pascal-editor/apps/editor/app/client-bootstrap.tsx @@ -9,15 +9,8 @@ // `loaded` guard inside `../lib/bootstrap` keeps the side effect // idempotent under HMR. import '../lib/bootstrap' -import { type ReactNode, useEffect } from 'react' +import type { ReactNode } from 'react' export function ClientBootstrap({ children }: { children: ReactNode }) { - useEffect(() => { - if (process.env.NODE_ENV !== 'development') return - // Loaded here (not via a `