perf: 优化管理端生产加载体验

- 图标与重型组件按需加载,优化菜单预取和页面请求链路

- 开启 gzip 与静态缓存并修复子路由 KeepAlive 冲突
This commit is contained in:
2026-07-22 20:35:55 +08:00
parent 9f06c238d3
commit 19059fde96
27 changed files with 750 additions and 233 deletions

View File

@@ -0,0 +1,31 @@
import type { RouteRecordStringComponent } from '@easyflow/types';
const UNSAFE_KEEP_ALIVE_MENU_PATHS = new Set([
'/ai/agents',
'/ai/documentCollection',
'/ai/model',
'/ai/skill',
'/ai/workflow',
'/dashboard/workspace',
'/sys/sysAccount',
]);
/**
* Disable route-level caching that conflicts with independent hidden child
* routes. Assigning false also replaces stale true values in persisted tabs.
*/
function disableUnsafeMenuRouteCaching(
routes: RouteRecordStringComponent[],
): RouteRecordStringComponent[] {
for (const route of routes) {
if (UNSAFE_KEEP_ALIVE_MENU_PATHS.has(route.path) && route.meta) {
route.meta.keepAlive = false;
}
if (route.children?.length) {
disableUnsafeMenuRouteCaching(route.children);
}
}
return routes;
}
export { disableUnsafeMenuRouteCaching };