RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix: handle Vite preload errors with automatic reload (#22086)
balibabu421c8687e3ab
diff --git a/web/src/main.tsx b/web/src/main.tsxindex c64e62e906..5fb43a44b1 100644--- a/web/src/main.tsx+++ b/web/src/main.tsx@@ -23,6 +23,24 @@ import './global.less';import { initLanguage } from './locales/config';import { fetchBillingStatus } from '@/ee/services/billingStatus';+// Vite dispatches `vite:preloadError` when a lazily imported chunk fails to+// load, typically because a stale tab still references hashed files that a+// newer deployment removed. Reload once to pick up the fresh index.html; if+// the failure repeats within ReloadGuardWindowMs, let the error reach the+// error boundary instead of reloading in a loop.+const ChunkReloadFlagKey = 'ragflow-chunk-reload-at';+const ReloadGuardWindowMs = 60_000;++window.addEventListener('vite:preloadError', (event) => {+ const lastReloadAt = Number(sessionStorage.getItem(ChunkReloadFlagKey) ?? 0);+ if (Date.now() - lastReloadAt < ReloadGuardWindowMs) {+ return;+ }+ sessionStorage.setItem(ChunkReloadFlagKey, String(Date.now()));+ event.preventDefault();+ window.location.reload();+});+initLanguage().then(() => fetchBillingStatus()).then(() => {