fix: 授权应用菜单分组去重 — 收藏的受控工具不再重复显示

This commit is contained in:
personal82555 committed 2026-10-12 09:57:58 +08:00
1 parent fac5727b3b
commit fed65ceb80
1 file changed
+7 -2
+7 -2
View File
@@ -49,14 +49,19 @@ function collapseAll() {
const PAID_GROUP_NAME = '授权应用';
const menuOptions = computed(() => {
// pull licensed tools out of their original categories
// pull licensed tools out of their original categories (dedupe by path:
// a paid tool may appear in both the favorites category and its own category)
const paidTools: Tool[] = [];
const paidPaths = new Set<string>();
const remaining = toolsByCategory.value
.map(({ name, components }) => ({
name,
components: components.filter((tool) => {
if (tool.path in PROTECTED_TOOLS) {
paidTools.push(tool);
if (!paidPaths.has(tool.path)) {
paidPaths.add(tool.path);
paidTools.push(tool);
}
return false;
}
return true;