diff --git a/frontend/src/components/map/MapWorkspace.tsx b/frontend/src/components/map/MapWorkspace.tsx index 1c37f22f..107a994e 100644 --- a/frontend/src/components/map/MapWorkspace.tsx +++ b/frontend/src/components/map/MapWorkspace.tsx @@ -1357,8 +1357,15 @@ export function MapWorkspace({ [themeInsights], ) const readSelectionThemeCount = useMemo( - () => new Set(themeResults.map((result) => result.theme.id)).size, - [themeResults], + () => { + const relevantThemeIds = new Set(selectionRelevantThemes.map((theme) => theme.id)) + return new Set( + themeResults + .filter((result) => relevantThemeIds.has(result.theme.id)) + .map((result) => result.theme.id), + ).size + }, + [selectionRelevantThemes, themeResults], ) const activeThemeInsight = themeResults.find((item) => item.theme.id === activeThemeId) const activeResultDataset = activeThemeInsight?.dataset ?? activeThemeDataset