fix(web): After a new release, old dynamic chunk files are deleted; force a page reload on preload error

This commit is contained in:
zhaoying
2026-04-17 14:21:36 +08:00
parent 52f7ea7456
commit 58c13aaeb4
2 changed files with 13 additions and 2 deletions

View File

@@ -126,7 +126,6 @@ const PageScrollList = forwardRef(<T, Q = Record<string, unknown>>({
// 内容不足以填满容器时,主动继续加载
setTimeout(() => {
const el = scrollRef.current;
console.log(el, el?.scrollHeight, el?.clientHeight, hasMoreRef.current)
if (el && hasMoreRef.current && el.scrollHeight <= el.clientHeight) {
loadMoreData();
}

View File

@@ -1,10 +1,22 @@
/*
* @Author: ZhaoYing
* @Date: 2025-12-02 20:28:01
* @Last Modified by: ZhaoYing
* @Last Modified time: 2026-04-17 14:19:14
*/
import { createRoot } from 'react-dom/client'
import '@/styles/index.css'
import App from '@/App.tsx'
// 同步导入i18n配置以确保在组件渲染前初始化完成
// Synchronously import i18n config to ensure initialization before component rendering
import './i18n'
// After a new release, old dynamic chunk files are deleted; force a page reload on preload error
window.addEventListener('vite:preloadError', () => {
console.warn('New version detected, reloading page to load latest assets...')
window.location.reload()
})
createRoot(document.getElementById('root')!)
.render(
<App />