fix: deduplicate toolbox count fallback

This commit is contained in:
Alireza Heidari
2026-07-06 13:23:55 +02:00
parent 4949d66c4a
commit 13341c2d55
+8 -2
View File
@@ -17,6 +17,7 @@ import {
buildToolEntries,
buildToolLabel,
buildToolSection,
countUniqueToolsInList,
countUniqueToolsInPanel,
FAVORITES_KEYS,
filterPanelByToolIds,
@@ -180,6 +181,8 @@ const defaultSectionsById = computed<Record<string, ToolPanelItem> | null>(() =>
return Object.keys(validSections).length > 0 ? validSections : null;
});
const myToolsDefaultSectionsById = computed(() => defaultSectionsById.value || localSectionsById.value);
// Use composable for favorites and recent tools — we only need the bits that
// drive the search-results split (favorites get their own section in mixed
// results). The full My-Tools landing state lives inside `MyToolsLanding.vue`.
@@ -189,7 +192,10 @@ const { favoritesCollapsed, favoriteToolIdSet, recentToolIdsToShowSet } = useToo
const { favoriteResults, nonFavoriteResults, hasMixedResults } = useFavoriteSearchResults(results, favoriteToolIdSet);
const toolsCount = computed(() =>
countUniqueToolsInPanel(defaultSectionsById.value || localSectionsById.value, toolsList.value.length),
countUniqueToolsInPanel(
defaultSectionsById.value || localSectionsById.value,
countUniqueToolsInList(toolsList.value),
),
);
const resultsSet = computed(() => new Set(results.value));
@@ -436,7 +442,7 @@ function onLabelToggle(labelId: string) {
<MyToolsLanding
v-if="showMyToolsLanding"
:local-tools-by-id="localToolsById"
:default-sections-by-id="defaultSectionsById"
:default-sections-by-id="myToolsDefaultSectionsById"
:local-sections-by-id="localSectionsById"
:tools-count="toolsCount"
@onClick="onToolClick"