fix: PR 审查真实缺陷修复(图标错位/定时器清理/并发/统计同步)

- AppDetailModal: iconPath 改用 viewingOrigin 动态计算,修复合并源切换时图标与数据错位
- App.vue: onUnmounted 清理 saveBoundsTimer 防抖定时器,避免组件销毁后悬空 IPC 调用
- App.vue: loadHomeListEntries 串行 for-of 改 Promise.all 并发拉取,缩短首页入口加载
- InstalledAppsModal: 顶部统计徽章基于搜索过滤结果实时计算,修复搜索时数字不同步

(审查误报项已核实未改: fetchAppFromStore 已有 encodeURIComponent + AbortSignal)
This commit is contained in:
xiyidaiwa
2026-08-11 00:20:19 +08:00
parent 44fa822146
commit 8888afd4f5
3 changed files with 31 additions and 14 deletions
+13 -2
View File
@@ -450,11 +450,22 @@ const hasOrigin = (app: App, origin: "spark" | "apm"): boolean =>
app.origins?.includes(origin) ?? app.origin === origin;
// APM / Spark 分别统计实际安装的包数量(同一 pkgname 同时装两种来源时各计一次)
// 搜索过滤后的全量(不叠加来源筛选),用于顶部统计徽章实时同步搜索结果,
// 避免搜索时列表缩减而徽章数字仍显示全量造成误导。
const searchFilteredApps = computed(() => {
const q = searchQuery.value.trim().toLowerCase();
if (!q) return props.apps;
return props.apps.filter(
(a) =>
a.name.toLowerCase().includes(q) || a.pkgname.toLowerCase().includes(q),
);
});
const apmCount = computed(
() => props.apps.filter((a) => hasOrigin(a, "apm")).length,
() => searchFilteredApps.value.filter((a) => hasOrigin(a, "apm")).length,
);
const sparkCount = computed(
() => props.apps.filter((a) => hasOrigin(a, "spark")).length,
() => searchFilteredApps.value.filter((a) => hasOrigin(a, "spark")).length,
);
// 总数 = APM 包数 + Spark 包数(不同来源视为不同包,单独计数)
const totalCount = computed(() => apmCount.value + sparkCount.value);