Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
feat: added cache clear and refresh with session limit
=bf61090b5ab2
diff --git a/frontend/src/main.tsx b/frontend/src/main.tsxindex f4789b3ebf..a2fe046563 100644--- a/frontend/src/main.tsx+++ b/frontend/src/main.tsx@@ -25,6 +25,34 @@ import "./translation";// Create a new router instanceNProgress.configure({ showSpinner: false });+window.addEventListener("vite:preloadError", async (event) => {+ event.preventDefault();+ // Get current count from session storage or initialize to 0+ const reloadCount = parseInt(sessionStorage.getItem("vitePreloadErrorCount") || "0", 10);++ // Check if we've already tried 3 times+ if (reloadCount >= 3) {+ console.warn("Vite preload has failed multiple times. Stopping automatic reload.");+ // Optionally show a user-facing message here+ return;+ }++ try {+ if ("caches" in window) {+ const keys = await caches.keys();+ await Promise.all(keys.map((key) => caches.delete(key)));+ }+ } catch (cleanupError) {+ console.error(cleanupError);+ }+ //+ // Increment and save the counter+ sessionStorage.setItem("vitePreloadErrorCount", (reloadCount + 1).toString());++ console.log(`Reloading page (attempt ${reloadCount + 1} of 3)...`);+ window.location.reload(); // for example, refresh the page+});+const router = createRouter({routeTree,context: { serverConfig: null, queryClient },