perf(web): 路由级懒加载,修复失效 useMemo 与 HMR 全页刷新

- 11 个页面改为 React.lazy;Login 与 MainLayout 保持同步加载(未登录用户与
  登录后首帧的必经路径);新增统一占位 RouteFallback,替换权限校验处重复的 div
  首屏静态资源 gzip 497.7 kB → 268.4 kB(-46.1%),>500 kB 体积警告消失
- PlatformUsers 的 columns/memberColumns/merchantColumns 每次渲染都重建,
  使依赖它们的 items 的 useMemo 完全失效;三个回调 useCallback 化、
  三个列定义 useMemo 化,让 memo 真正命中
- useAuth/AuthContext 拆到 store/authContext.ts,使 store/auth.tsx 只导出
  AuthProvider 组件,消除 react(only-export-components) 导致的 HMR 整页刷新
  (同步更新 7 处引用)
- MainLayout 未使用的 catch 参数清理

oxlint:5 warnings → 0 warnings / 0 errors。
This commit is contained in:
yml2213
2026-10-06 19:43:21 +08:00
parent ae71bc99b8
commit c9e35d5d90
9 changed files with 75 additions and 58 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ import { useState } from 'react'
import { useNavigate } from 'react-router-dom'
import { Form, Input, Button, Typography, message, Space } from 'antd'
import { UserOutlined, LockOutlined, RightOutlined } from '@ant-design/icons'
import { useAuth } from '../store/auth'
import { useAuth } from '../store/authContext'
export default function Login() {
const { login } = useAuth()