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.

fix(search): local fuzzy document search returns non-document results (#2242)

gbirman68535461f856
diff --git a/js/app/bun.lock b/js/app/bun.lock
index 36aa8e1982..bbc64f3f27 100644
--- a/js/app/bun.lock
+++ b/js/app/bun.lock
@@ -101,7 +101,7 @@
"zod": "^3.23.8",
},
"devDependencies": {
- "@biomejs/biome": "2.2.6",
+ "@biomejs/biome": "2.4.7",
"@playwright/test": "^1.55.1",
"@solidjs/meta": "^0.29.4",
"@solidjs/testing-library": "^0.8.10",
@@ -444,23 +444,23 @@
"@babel/types": ["@babel/[email protected]", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q=="],
- "@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.2.6", "@biomejs/cli-darwin-x64": "2.2.6", "@biomejs/cli-linux-arm64": "2.2.6", "@biomejs/cli-linux-arm64-musl": "2.2.6", "@biomejs/cli-linux-x64": "2.2.6", "@biomejs/cli-linux-x64-musl": "2.2.6", "@biomejs/cli-win32-arm64": "2.2.6", "@biomejs/cli-win32-x64": "2.2.6" }, "bin": { "biome": "bin/biome" } }, "sha512-yKTCNGhek0rL5OEW1jbLeZX8LHaM8yk7+3JRGv08my+gkpmtb5dDE+54r2ZjZx0ediFEn1pYBOJSmOdDP9xtFw=="],
+ "@biomejs/biome": ["@biomejs/[email protected]", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.4.7", "@biomejs/cli-darwin-x64": "2.4.7", "@biomejs/cli-linux-arm64": "2.4.7", "@biomejs/cli-linux-arm64-musl": "2.4.7", "@biomejs/cli-linux-x64": "2.4.7", "@biomejs/cli-linux-x64-musl": "2.4.7", "@biomejs/cli-win32-arm64": "2.4.7", "@biomejs/cli-win32-x64": "2.4.7" }, "bin": { "biome": "bin/biome" } }, "sha512-vXrgcmNGZ4lpdwZSpMf1hWw1aWS6B+SyeSYKTLrNsiUsAdSRN0J4d/7mF3ogJFbIwFFSOL3wT92Zzxia/d5/ng=="],
- "@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-UZPmn3M45CjTYulgcrFJFZv7YmK3pTxTJDrFYlNElT2FNnkkX4fsxjExTSMeWKQYoZjvekpH5cvrYZZlWu3yfA=="],
+ "@biomejs/cli-darwin-arm64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Oo0cF5mHzmvDmTXw8XSjhCia8K6YrZnk7aCS54+/HxyMdZMruMO3nfpDsrlar/EQWe41r1qrwKiCa2QDYHDzWA=="],
- "@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-HOUIquhHVgh/jvxyClpwlpl/oeMqntlteL89YqjuFDiZ091P0vhHccwz+8muu3nTyHWM5FQslt+4Jdcd67+xWQ=="],
+ "@biomejs/cli-darwin-x64": ["@biomejs/[email protected]", "", { "os": "darwin", "cpu": "x64" }, "sha512-I+cOG3sd/7HdFtvDSnF9QQPrWguUH7zrkIMMykM3PtfWU9soTcS2yRb9Myq6MHmzbeCT08D1UmY+BaiMl5CcoQ=="],
- "@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-BpGtuMJGN+o8pQjvYsUKZ+4JEErxdSmcRD/JG3mXoWc6zrcA7OkuyGFN1mDggO0Q1n7qXxo/PcupHk8gzijt5g=="],
+ "@biomejs/cli-linux-arm64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-om6FugwmibzfP/6ALj5WRDVSND4H2G9X0nkI1HZpp2ySf9lW2j0X68oQSaHEnls6666oy4KDsc5RFjT4m0kV0w=="],
- "@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-TjCenQq3N6g1C+5UT3jE1bIiJb5MWQvulpUngTIpFsL4StVAUXucWD0SL9MCW89Tm6awWfeXBbZBAhJwjyFbRQ=="],
+ "@biomejs/cli-linux-arm64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "arm64" }, "sha512-I2NvM9KPb09jWml93O2/5WMfNR7Lee5Latag1JThDRMURVhPX74p9UDnyTw3Ae6cE1DgXfw7sqQgX7rkvpc0vw=="],
- "@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-1HaM/dpI/1Z68zp8ZdT6EiBq+/O/z97a2AiHMl+VAdv5/ELckFt9EvRb8hDHpk8hUMoz03gXkC7VPXOVtU7faA=="],
+ "@biomejs/cli-linux-x64": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-bV8/uo2Tj+gumnk4sUdkerWyCPRabaZdv88IpbmDWARQQoA/Q0YaqPz1a+LSEDIL7OfrnPi9Hq1Llz4ZIGyIQQ=="],
- "@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-1ZcBux8zVM3JhWN2ZCPaYf0+ogxXG316uaoXJdgoPZcdK/rmRcRY7PqHdAos2ExzvjIdvhQp72UcveI98hgOog=="],
+ "@biomejs/cli-linux-x64-musl": ["@biomejs/[email protected]", "", { "os": "linux", "cpu": "x64" }, "sha512-00kx4YrBMU8374zd2wHuRV5wseh0rom5HqRND+vDldJPrWwQw+mzd/d8byI9hPx926CG+vWzq6AeiT7Yi5y59g=="],
- "@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-h3A88G8PGM1ryTeZyLlSdfC/gz3e95EJw9BZmA6Po412DRqwqPBa2Y9U+4ZSGUAXCsnSQE00jLV8Pyrh0d+jQw=="],
+ "@biomejs/cli-win32-arm64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "arm64" }, "sha512-hOUHBMlFCvDhu3WCq6vaBoG0dp0LkWxSEnEEsxxXvOa9TfT6ZBnbh72A/xBM7CBYB7WgwqboetzFEVDnMxelyw=="],
- "@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-yx0CqeOhPjYQ5ZXgPfu8QYkgBhVJyvWe36as7jRuPrKPO5ylVDfwVtPQ+K/mooNTADW0IhxOZm3aPu16dP8yNQ=="],
+ "@biomejs/cli-win32-x64": ["@biomejs/[email protected]", "", { "os": "win32", "cpu": "x64" }, "sha512-qEpGjSkPC3qX4ycbMUthXvi9CkRq7kZpkqMY1OyhmYlYLnANnooDQ7hDerM8+0NJ+DZKVnsIc07h30XOpt7LtQ=="],
"@codemirror/autocomplete": ["@codemirror/[email protected]", "", { "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.17.0", "@lezer/common": "^1.0.0" } }, "sha512-PHHBXFomUs5DF+9tCOM/UoW6XQ4R44lLNNhRaW9PKPTU0D7lIjRg3ElxaJnTwsl/oHiR93WSXDBrekhoUGCPtg=="],
diff --git a/js/app/package.json b/js/app/package.json
index ab11bf8e96..d7fe95b599 100644
--- a/js/app/package.json
+++ b/js/app/package.json
@@ -118,7 +118,7 @@
"zod": "^3.23.8"
},
"devDependencies": {
- "@biomejs/biome": "2.2.6",
+ "@biomejs/biome": "2.4.7",
"@playwright/test": "^1.55.1",
"@solidjs/meta": "^0.29.4",
"@solidjs/testing-library": "^0.8.10",
diff --git a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
index a8c54e538d..f36dbd05fa 100644
--- a/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
+++ b/js/app/packages/app/component/app-sidebar/soup-filter-presets.ts
@@ -187,7 +187,7 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
},
project_filters: { project_ids: EXCLUDE },
},
- clientFilters: { and: ['not-task'] },
+ clientFilters: { and: ['document-or-file'] },
};
},
shared: () => ({
@@ -199,7 +199,7 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
},
project_filters: { project_ids: EXCLUDE },
},
- clientFilters: { and: ['not-task', 'shared-entity'] },
+ clientFilters: { and: ['document-or-file', 'shared-entity'] },
}),
attachments: () => ({
queryFilters: {
@@ -209,14 +209,14 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
},
project_filters: { project_ids: EXCLUDE },
},
- clientFilters: { and: ['not-task'] },
+ clientFilters: { and: ['document-or-file'] },
}),
all: () => ({
queryFilters: {
...QUERY_FILTERS.documentAndFile,
project_filters: { project_ids: EXCLUDE },
},
- clientFilters: { and: ['not-task'] },
+ clientFilters: { and: ['document-or-file'] },
}),
},
},
diff --git a/js/app/packages/app/component/next-soup/filters/configs.ts b/js/app/packages/app/component/next-soup/filters/configs.ts
index da5ad2a917..a66b1f3e24 100644
--- a/js/app/packages/app/component/next-soup/filters/configs.ts
+++ b/js/app/packages/app/component/next-soup/filters/configs.ts
@@ -400,6 +400,11 @@ export const createSoupFilters = (
label: 'Not Task',
predicate: (entity) => !taskFilter(entity),
},
+ {
+ id: 'document-or-file',
+ label: 'Documents & Files',
+ predicate: (entity) => entity.type === 'document' && !taskFilter(entity),
+ },
{
id: 'active-task',
label: 'Task active',
diff --git a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
index d9317c6e88..7af6f2ddee 100644
--- a/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/soup-view-tabs.tsx
@@ -106,16 +106,18 @@ export const useApplyPreset = () => {
});
};
- const applyTabPreset = (view: ListView, tabId: string) => {
+ const applyTabPreset = (view: ListView, tabId: string): boolean => {
const config = VIEW_TAB_PRESETS[view];
+ if (!config) return false;
const resolver = config.tabs[tabId];
- if (!resolver) return;
+ if (!resolver) return false;
const resolved = resolver(getPresetContext());
- if (!resolved) return;
+ if (!resolved) return false;
setActiveTab(tabId);
applyPreset(resolved);
+ return true;
};
return { applyTabPreset };
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 205a577aef..519583bd22 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
@@ -148,6 +148,7 @@ const useSoupNotificationInvalidators = () => {
};
type PersistedSoupViewState = {
+ version?: number;
activeTab: string | undefined;
filters: { and: string[]; or: string[] };
queryFilters: SoupItemsQueryFilters;
@@ -156,6 +157,8 @@ type PersistedSoupViewState = {
assigneeFilter: string[];
};
+const PERSISTED_STATE_VERSION = 1;
+
// Tracks how many SoupViewList instances are mounted per contentId.
// Used to detect duplicate splits showing the same view.
const activeSoupViewCounts = new Map<string, number>();
@@ -653,11 +656,26 @@ export const SoupViewList = (props: SoupViewListProps) => {
// Set initial state
onMount(() => {
if (initialPersistedState) {
+ const isStale =
+ (initialPersistedState.version ?? 0) < PERSISTED_STATE_VERSION;
+ const applied =
+ isStale &&
+ isListViewID(contentId) &&
+ initialPersistedState.activeTab &&
+ applyTabPreset(contentId, initialPersistedState.activeTab);
+ if (!applied) {
+ batch(() => {
+ soup.filters.set(
+ isStale
+ ? (props.initialClientFilters ?? { and: [], or: [] })
+ : (initialPersistedState.filters ?? { and: [], or: [] })
+ );
+ setQueryFilters(initialPersistedState.queryFilters ?? {});
+ setActiveTab(initialPersistedState.activeTab);
+ });
+ }
batch(() => {
- soup.filters.set(initialPersistedState.filters ?? { and: [], or: [] });
- setQueryFilters(initialPersistedState.queryFilters ?? {});
soup.sort.setAll(initialPersistedState.sort ?? []);
- setActiveTab(initialPersistedState.activeTab);
setAssigneeFilter(initialPersistedState.assigneeFilter ?? []);
});
} else {
@@ -671,6 +689,7 @@ export const SoupViewList = (props: SoupViewListProps) => {
on(
() =>
({
+ version: PERSISTED_STATE_VERSION,
activeTab: activeTab(),
filters: {
and: soup.filters.andFilters().map((f) => f.id),