Port admin-web's chunk-reload guard to ops-web (vite:preloadError + router.onError) so a stale tab landing on a lazy-loaded route triggers a single reload instead of a hard 404. Also force index.html through revalidation on both apps so the reload actually fetches a fresh entry referencing the new chunk hashes; hashed asset URLs keep their long immutable cache. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
|
||||
import { isChunkLoadError, reloadForStaleChunk } from '@/lib/chunk-reload'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { pinia } from '@/stores/pinia'
|
||||
|
||||
@@ -143,3 +144,9 @@ router.afterEach((to) => {
|
||||
document.title = `${t} · 省心推`
|
||||
}
|
||||
})
|
||||
|
||||
router.onError((err) => {
|
||||
if (isChunkLoadError(err)) {
|
||||
reloadForStaleChunk()
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user