fix(web): blank-screen hardening — stale chunk recovery, error boundary, no-cache index.html

- main.tsx: on vite:preloadError (stale index.html referencing removed
  hashed chunks after a redeploy) reload the page immediately.
- New ErrorBoundary around the whole router: render errors show a Persian
  fallback with «تلاش مجدد» instead of wiping the DOM.
- nginx: index.html served with Cache-Control no-cache,no-store,
  must-revalidate (verified live); /assets/* stays public, immutable.
This commit is contained in:
2026-09-06 19:03:27 +03:30
parent 4dd60d7cd9
commit 1f123a0a05
4 changed files with 67 additions and 3 deletions
+8
View File
@@ -7,6 +7,14 @@ import App from "./App";
import "./styles/globals.css";
import { queryClient } from "./lib/queryClient";
// بعد از استقرار نسخه‌ی جدید، مرورگری که index.html قدیمی را باز کرده برای
// بارگذاری chunkهای حذف‌شده 404 می‌گیرد و صفحه خالی می‌ماند. این شنونده،
// همان لحظه صفحه را دوباره بارگذاری می‌کند تا نسخه‌ی تازه (با نام فایل‌های
// درست) گرفته شود.
window.addEventListener("vite:preloadError", () => {
window.location.reload();
});
createRoot(document.getElementById("root")!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>