feat: KB Accelerator — convert KB articles into interactive flows #104
@@ -7,7 +7,29 @@ interface FallbackProps {
|
||||
resetError: () => void
|
||||
}
|
||||
|
||||
function isChunkLoadError(error: Error): boolean {
|
||||
const msg = error.message || ''
|
||||
return (
|
||||
msg.includes('dynamically imported module') ||
|
||||
msg.includes('Loading chunk') ||
|
||||
msg.includes('Failed to fetch') ||
|
||||
error.name === 'ChunkLoadError'
|
||||
)
|
||||
}
|
||||
|
||||
function DefaultFallback({ error, resetError }: FallbackProps) {
|
||||
// Auto-reload on stale chunk errors (happens after deployments)
|
||||
if (isChunkLoadError(error)) {
|
||||
const key = 'rf_boundary_chunk_reload'
|
||||
const lastReload = sessionStorage.getItem(key)
|
||||
const now = Date.now()
|
||||
if (!lastReload || now - Number(lastReload) > 10_000) {
|
||||
sessionStorage.setItem(key, String(now))
|
||||
window.location.reload()
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex min-h-[400px] flex-col items-center justify-center p-8">
|
||||
<div className="max-w-md text-center">
|
||||
|
||||
Reference in New Issue
Block a user