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): not all documents showing for search soup index (#2489)

gbirman2e4bc348b5e0
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search-filter-controls.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search-filter-controls.tsx
index f92fcfc586..df9a19361b 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search-filter-controls.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search-filter-controls.tsx
@@ -21,7 +21,7 @@ export const INDEX_OPTIONS: (Option & { queryFilters: SoupBody })[] = [
queryFilters: QUERY_FILTERS.channels,
},
{
- value: 'document',
+ value: 'document-or-file',
label: 'Documents',
icon: () => <EntityIcon targetType="md" size="xs" theme="monochrome" />,
queryFilters: QUERY_FILTERS.documentAndFile,
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 a745553659..ceb1100fef 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
@@ -107,6 +107,7 @@ import {
import { Button } from '@app/component/next-soup/soup-view/filters-bar/button';
import { LabelAndHotKey, Tooltip } from '@core/component/Tooltip';
import SearchIcon from '@macro-icons/macro-magnifying-glass.svg';
+import { QUERY_FILTERS } from '../filters/query-filters';
const useSoupNotificationInvalidators = () => {
const notificationSource = useGlobalNotificationSource();
@@ -168,7 +169,7 @@ type PersistedSoupViewState = {
assigneeFilter: string[];
};
-const PERSISTED_STATE_VERSION = 1;
+const PERSISTED_STATE_VERSION = 2;
// Tracks how many SoupViewList instances are mounted per contentId.
// Used to detect duplicate splits showing the same view.
@@ -675,7 +676,11 @@ export const SoupViewList = (props: SoupViewListProps) => {
? (props.initialClientFilters ?? { and: [], or: [] })
: (initialPersistedState.filters ?? { and: [], or: [] })
);
- setQueryFilters(initialPersistedState.queryFilters ?? {});
+ setQueryFilters(
+ isStale
+ ? QUERY_FILTERS.default
+ : (initialPersistedState.queryFilters ?? QUERY_FILTERS.default)
+ );
setActiveTab(initialPersistedState.activeTab);
});
}
diff --git a/js/app/packages/core/util/dateSearch/useDateSearch.test.ts b/js/app/packages/core/util/dateSearch/useDateSearch.test.ts
index 4750ebbab8..be8b869f57 100644
--- a/js/app/packages/core/util/dateSearch/useDateSearch.test.ts
+++ b/js/app/packages/core/util/dateSearch/useDateSearch.test.ts
@@ -1,4 +1,4 @@
-import { describe, expect, it } from 'vitest';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { createRoot, createSignal } from 'solid-js';
import { addDays } from 'date-fns';
import {
@@ -531,9 +531,18 @@ describe('parseTime', () => {
describe('useDateSearch with time', () => {
const baseDate = new Date('2024-06-15T10:00:00');
+ beforeEach(() => {
+ vi.useFakeTimers();
+ vi.setSystemTime(new Date('2024-06-15T14:00:00'));
+ });
+
+ afterEach(() => {
+ vi.useRealTimers();
+ });
+
it('should bump standalone time to tomorrow if already past today', () => {
createRoot((dispose) => {
- // Use a time that's guaranteed to be in the past (1am - test won't run at 1am)
+ // 1am is in the past relative to the frozen 2pm clock
const [query] = createSignal('1am');
const options = useDateSearch({ query, baseDate });
@@ -543,12 +552,8 @@ describe('useDateSearch with time', () => {
const timeOption = result.find((opt) => opt.id.startsWith('time-'));
expect(timeOption).toBeTruthy();
- const now = new Date();
- const tomorrow = new Date(now);
- tomorrow.setDate(tomorrow.getDate() + 1);
-
- // 1am is almost certainly in the past, so it should be tomorrow
- expect(timeOption?.date.getDate()).toBe(tomorrow.getDate());
+ // Should be tomorrow (June 16) at 1am since 1am today is past
+ expect(timeOption?.date.getDate()).toBe(16);
expect(timeOption?.date.getHours()).toBe(1);
expect(timeOption?.date.getMinutes()).toBe(0);