fix: 授权应用菜单分组去重 — 收藏的受控工具不再重复显示
This commit is contained in:
1 parent
fac5727b3b
commit
fed65ceb80
1 file changed
+7
-2
@@ -49,14 +49,19 @@ function collapseAll() {
|
|||||||
const PAID_GROUP_NAME = '授权应用';
|
const PAID_GROUP_NAME = '授权应用';
|
||||||
|
|
||||||
const menuOptions = computed(() => {
|
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 paidTools: Tool[] = [];
|
||||||
|
const paidPaths = new Set<string>();
|
||||||
const remaining = toolsByCategory.value
|
const remaining = toolsByCategory.value
|
||||||
.map(({ name, components }) => ({
|
.map(({ name, components }) => ({
|
||||||
name,
|
name,
|
||||||
components: components.filter((tool) => {
|
components: components.filter((tool) => {
|
||||||
if (tool.path in PROTECTED_TOOLS) {
|
if (tool.path in PROTECTED_TOOLS) {
|
||||||
paidTools.push(tool);
|
if (!paidPaths.has(tool.path)) {
|
||||||
|
paidPaths.add(tool.path);
|
||||||
|
paidTools.push(tool);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in new issue
Block a user