mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-13 12:17:24 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bd51c142f6 | |||
| 2af6157265 |
@@ -8,6 +8,10 @@ and this project adheres to
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Fixed
|
||||
|
||||
- ✨(frontend) recover from stale lazy-loaded chunks after a deploy
|
||||
|
||||
## [1.26.0] - 2026-08-12
|
||||
|
||||
### Added
|
||||
|
||||
@@ -74,6 +74,13 @@ server {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
try_files $uri =404;
|
||||
error_page 404 = @asset_missing;
|
||||
}
|
||||
|
||||
location @asset_missing {
|
||||
add_header Cache-Control "no-store" always;
|
||||
return 404;
|
||||
}
|
||||
|
||||
# Serve static files
|
||||
|
||||
@@ -14,6 +14,13 @@ server {
|
||||
location ~* ^/assets/.*\.(css|js|json|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
|
||||
expires 30d;
|
||||
add_header Cache-Control "public, max-age=2592000";
|
||||
try_files $uri =404;
|
||||
error_page 404 = @asset_missing;
|
||||
}
|
||||
|
||||
location @asset_missing {
|
||||
add_header Cache-Control "no-store" always;
|
||||
return 404;
|
||||
}
|
||||
|
||||
# Serve static files
|
||||
|
||||
@@ -2,6 +2,26 @@ import React from 'react'
|
||||
import ReactDOM from 'react-dom/client'
|
||||
import App from './App.tsx'
|
||||
|
||||
const CHUNK_RELOAD_KEY = 'vite-preload-error-reload-at'
|
||||
const RELOAD_COOLDOWN_MS = 30_000
|
||||
|
||||
window.addEventListener('vite:preloadError', (event) => {
|
||||
try {
|
||||
const lastReloadAt = Number(sessionStorage.getItem(CHUNK_RELOAD_KEY)) || 0
|
||||
if (Date.now() - lastReloadAt <= RELOAD_COOLDOWN_MS) {
|
||||
// Recent reload didn't help: not a stale deploy, surface the error.
|
||||
return
|
||||
}
|
||||
sessionStorage.setItem(CHUNK_RELOAD_KEY, String(Date.now()))
|
||||
} catch {
|
||||
// Without sessionStorage we cannot guard against a reload loop:
|
||||
// don't auto-reload, let the error propagate.
|
||||
return
|
||||
}
|
||||
event.preventDefault()
|
||||
window.location.reload()
|
||||
})
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')!).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
|
||||
Reference in New Issue
Block a user