Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
fix(search): bypass featured count for channels (#2365)
gbirman3e5bc18e0837
diff --git a/js/app/packages/app/component/next-soup/soup-view/create-search-state.ts b/js/app/packages/app/component/next-soup/soup-view/create-search-state.tsindex 1ff15dc464..2f0bc3f478 100644--- a/js/app/packages/app/component/next-soup/soup-view/create-search-state.ts+++ b/js/app/packages/app/component/next-soup/soup-view/create-search-state.ts@@ -7,7 +7,7 @@ import {nameFuzzySearchFilter,} from '@app/component/next-soup/search-utils';import { debouncedDependent } from '@core/util/debounce';-import type { EntityData } from '@entity';+import { isChannelEntity, type EntityData } from '@entity';import type { SoupItemsQueryFilters } from '@queries/soup/items';import {useSearchSoupQuery,@@ -18,6 +18,8 @@ import { type Accessor, createMemo, createSignal, on } from 'solid-js';const SEARCH_SERVICE_DEBOUNCE_MS = 300;const LOCAL_FUZZY_SEARCH_DEBOUNCE_MS = 20;+// Max number of non-channel local results to feature. Channels bypass this+// limit since they are only searched locally, not via the backend search service.const FEATURED_COUNT = 3;const freshSearch = createSoupFreshSearch();@@ -116,11 +118,17 @@ export const createSearchState = ({const filteredLocalFuzzyResults = createMemo(() => {if (!localFuzzyResults()) return [];const activeFilters = getValidSearchFilters(soup.filters.active());- if (activeFilters.length === 0)- return localFuzzyResults().slice(0, FEATURED_COUNT);- const pools = activeFilters.map((f) => allFiltersResults().get(f.id) ?? []);- const merged = intersectEntityPools(pools);- return merged.slice(0, FEATURED_COUNT);+ const results =+ activeFilters.length === 0+ ? localFuzzyResults()+ : intersectEntityPools(+ activeFilters.map((f) => allFiltersResults().get(f.id) ?? [])+ );+ const channels = results.filter((e) => isChannelEntity(e));+ const nonChannels = results+ .filter((e) => !isChannelEntity(e))+ .slice(0, FEATURED_COUNT);+ return [...channels, ...nonChannels];});const serviceSearchResults = createMemo<EntityData[]>(() => {