Add toolbox spaces and recover from stale asset bundles
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 18s
This commit is contained in:
parent
0959c6740b
commit
0acf5ecf21
30 changed files with 1252 additions and 179 deletions
|
|
@ -11,6 +11,33 @@
|
|||
<title>Sokko G</title>
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml" />
|
||||
<link rel="alternate icon" href="/favicon.ico" sizes="any" />
|
||||
<script>
|
||||
(() => {
|
||||
const recoveryParameter = "_asset-recovery";
|
||||
|
||||
function reloadWithFreshAssets() {
|
||||
const recoveryUrl = new URL(window.location.href);
|
||||
if (recoveryUrl.searchParams.has(recoveryParameter)) return;
|
||||
recoveryUrl.searchParams.set(recoveryParameter, Date.now().toString());
|
||||
window.location.replace(recoveryUrl);
|
||||
}
|
||||
|
||||
window.addEventListener("error", (event) => {
|
||||
const resource = event.target;
|
||||
if (!(resource instanceof HTMLScriptElement) || resource.type !== "module") return;
|
||||
|
||||
const resourceUrl = new URL(resource.src, window.location.href);
|
||||
if (resourceUrl.origin === window.location.origin && resourceUrl.pathname.startsWith("/assets/")) {
|
||||
reloadWithFreshAssets();
|
||||
}
|
||||
}, true);
|
||||
|
||||
window.addEventListener("vite:preloadError", (event) => {
|
||||
event.preventDefault();
|
||||
reloadWithFreshAssets();
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue