caching and redirection changes
This commit is contained in:
@@ -1,5 +1,30 @@
|
||||
// @refresh reload
|
||||
import { injectSpeedInsights } from "@vercel/speed-insights";
|
||||
import { mount, StartClient } from "@solidjs/start/client";
|
||||
|
||||
// Handle chunk loading failures from stale cache
|
||||
window.addEventListener("error", (event) => {
|
||||
if (
|
||||
event.message?.includes("Importing a module script failed") ||
|
||||
event.message?.includes("Failed to fetch dynamically imported module")
|
||||
) {
|
||||
console.warn("Chunk load error detected, reloading page...");
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
window.addEventListener("unhandledrejection", (event) => {
|
||||
if (
|
||||
event.reason?.message?.includes("Importing a module script failed") ||
|
||||
event.reason?.message?.includes(
|
||||
"Failed to fetch dynamically imported module"
|
||||
)
|
||||
) {
|
||||
console.warn("Chunk load error detected, reloading page...");
|
||||
event.preventDefault();
|
||||
window.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
injectSpeedInsights();
|
||||
mount(() => <StartClient />, document.getElementById("app")!);
|
||||
|
||||
Reference in New Issue
Block a user