Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

feat(search): filter out local search from inbox (#2286)

gbirmana255892e2568
diff --git a/js/app/bun.lock b/js/app/bun.lock
index 3ec55f4cdd..d6dfc7b990 100644
--- a/js/app/bun.lock
+++ b/js/app/bun.lock
@@ -2318,7 +2318,7 @@
"pathval": ["[email protected]", "", {}, "sha512-vE7JKRyES09KiunauX7nd2Q9/L7lhok4smP9RZTDeD4MVs72Dp2qNFVz39Nz5a0FVEW0BJR6C0DYrq6unoziZA=="],
- "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6", "sha512-HDFaPbCxLG2GHpf1smUG97nku5aPGBGaCcIbK05dGdp07TBLUlDcXsM4WcE82mO5W4RBPIBVYobX5N/6M6NFrA=="],
+ "pdfjs-dist": ["pdfjs-dist@github:macro-inc/pdf.js#f9b2ce6", { "dependencies": { "dommatrix": "^1.0.3", "web-streams-polyfill": "^3.2.1" }, "peerDependencies": { "worker-loader": "^3.0.8" }, "optionalPeers": ["worker-loader"] }, "macro-inc-pdf.js-f9b2ce6"],
"performance-now": ["[email protected]", "", {}, "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow=="],
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.ts
index 1e6086877e..1ff15dc464 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
@@ -25,11 +25,13 @@ const freshSearch = createSoupFreshSearch();
interface CreateSearchStateArgs {
soup: SoupState;
queryFilters: Accessor<SoupItemsQueryFilters>;
+ disableLocalSearch?: boolean;
}
export const createSearchState = ({
soup,
queryFilters,
+ disableLocalSearch,
}: CreateSearchStateArgs) => {
const [searchText, setSearchText] = createSignal('');
@@ -82,6 +84,7 @@ export const createSearchState = ({
const localFuzzyResults = createMemo(
on(debouncedSearchForLocal, (query) => {
+ if (disableLocalSearch) return [];
if (!query || query.length === 0) return [];
const pool = entityPool();
// TODO: we can optimize fresh search for small feature counts since we
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
index d5391d7250..ab3b508178 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-context.tsx
@@ -99,6 +99,7 @@ export const useMaybeSoupView = () => useContext(SoupViewContext);
interface SoupViewContextProviderProps {
soup?: SoupState;
queryFilters?: SoupBody;
+ disableLocalSearch?: boolean;
}
type ApiSortMethod = NonNullable<SoupParams['sort_method']>;
@@ -158,7 +159,11 @@ export const SoupViewContextProvider: FlowComponent<
})
);
- const search = createSearchState({ soup, queryFilters });
+ const search = createSearchState({
+ soup,
+ queryFilters,
+ disableLocalSearch: props.disableLocalSearch,
+ });
const notificationSource = useGlobalNotificationSource();
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
index 5c690a672c..0b55193cc8 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
@@ -179,6 +179,7 @@ interface SoupViewProps {
viewName: string;
initialClientFilters?: { and?: FilterID[]; or?: FilterID[] };
queryFilters?: SoupItemsQueryFilters;
+ disableLocalSearch?: boolean;
}
export const SoupView = (props: SoupViewProps) => {
@@ -224,7 +225,11 @@ export const SoupView = (props: SoupViewProps) => {
soup.previewEntity() ? { side: 'left', percentage: 30 } : undefined,
}}
>
- <SoupViewContextProvider soup={soup} queryFilters={props.queryFilters}>
+ <SoupViewContextProvider
+ soup={soup}
+ queryFilters={props.queryFilters}
+ disableLocalSearch={props.disableLocalSearch}
+ >
<div class="size-full flex flex-col">
<div class="flex flex-col w-full">
<SplitHeaderLeft>
diff --git a/js/app/packages/app/component/split-layout/componentRegistry.tsx b/js/app/packages/app/component/split-layout/componentRegistry.tsx
index d697f885d3..9887d8214e 100644
--- a/js/app/packages/app/component/split-layout/componentRegistry.tsx
+++ b/js/app/packages/app/component/split-layout/componentRegistry.tsx
@@ -109,6 +109,7 @@ registerComponent(
viewName="Inbox"
queryFilters={preset.queryFilters}
initialClientFilters={preset.clientFilters}
+ disableLocalSearch
/>
);
})