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(soup): add created_by filter to file and task views (#5650)

Seamus6e13cdb1b409
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
index 8f2f18ffc2..80b187f1af 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
@@ -9,6 +9,7 @@ import {
getActiveDocumentTypeFilterIds,
isDocumentTypeFilterId,
} from '@app/features/next-soup/filters/configs/document-type-query';
+import { getViewPreset } from '@app/features/next-soup/sidebar/soup-filter-presets';
import {
CHANNEL_SORT_OPTIONS,
DEFAULT_SORT_OPTIONS,
@@ -75,13 +76,20 @@ export const MobileFilterDrawer = () => {
const { consolidatedFiltersList, resetToTabDefaults, handleAssigneeChange } =
useFilterRefinements();
- const { soup, queryFilters, assigneeFilter, inboxFilter, setInboxFilter } =
- useSoupView();
+ const {
+ soup,
+ queryFilters,
+ assigneeFilter,
+ activeTab,
+ inboxFilter,
+ setInboxFilter,
+ } = useSoupView();
const panel = useSplitPanelOrThrow();
const contacts = useContacts();
const userId = useUserId();
const [assigneeSearch, setAssigneeSearch] = createSignal('');
+ const [createdBySearch, setCreatedBySearch] = createSignal('');
const currentView = createMemo((): ListView | undefined => {
const content = panel.handle.content();
@@ -93,10 +101,32 @@ export const MobileFilterDrawer = () => {
const categories = createMemo(() => {
const view = currentView();
if (!view) return [];
+ if (view === 'documents' && activeTab() === 'folders') return [];
return VIEW_FILTER_CATEGORIES[view] ?? [];
});
const isTasksView = () => currentView() === 'tasks';
+ const isDocumentsView = () => currentView() === 'documents';
+ const isCreatedByFilterView = () => {
+ const view = currentView();
+ return view === 'documents' || view === 'tasks';
+ };
+ const showCreatedByFilter = () =>
+ isCreatedByFilterView() && !(isDocumentsView() && activeTab() === 'owned');
+
+ const baseCreatedByIds = createMemo(() => {
+ const view = currentView();
+ if (view !== 'documents' && view !== 'tasks') return [];
+ return (
+ getViewPreset(view, activeTab(), {
+ userId: userId(),
+ isTeamAdmin: false,
+ })?.filters.include?.documentOwnerId ?? []
+ );
+ });
+ const createdByIds = createMemo(
+ () => queryFilters.state.include.documentOwnerId ?? []
+ );
const picker = useInboxPicker({
selectedIds: inboxFilter,
@@ -241,6 +271,49 @@ export const MobileFilterDrawer = () => {
);
});
+ const createdByOptions = createMemo(() => {
+ const currentUserId = userId();
+ return [...contacts()]
+ .sort((a, b) => {
+ if (a.id === currentUserId) return -1;
+ if (b.id === currentUserId) return 1;
+ return 0;
+ })
+ .map((contact) => ({
+ id: contact.id,
+ label: buildContactLabel(contact, currentUserId),
+ icon: () => (
+ <UserIcon
+ id={contact.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ }));
+ });
+
+ const filteredCreatedByOptions = createMemo(() => {
+ const query = createdBySearch().toLowerCase();
+ if (!query) return createdByOptions();
+ return createdByOptions().filter((option) =>
+ option.label.toLowerCase().includes(query)
+ );
+ });
+
+ const toggleCreatedBy = (id: string) => {
+ const current = createdByIds();
+ const next = current.includes(id)
+ ? current.filter((creatorId) => creatorId !== id)
+ : [...current, id];
+ const nextIds = next.length > 0 ? next : baseCreatedByIds();
+ queryFilters.set({
+ include: {
+ documentOwnerId: nextIds.length > 0 ? nextIds : undefined,
+ },
+ });
+ };
+
const activeCount = () => consolidatedFiltersList().length;
const [scrollRef, setScrollRef] = createSignal<HTMLElement>();
@@ -614,6 +687,94 @@ export const MobileFilterDrawer = () => {
</Accordion.Content>
</MobileDrawer.Section>
</Show>
+
+ {/* Created by section for Tasks and Files */}
+ <Show when={showCreatedByFilter()}>
+ <MobileDrawer.Section
+ as={Accordion.Item}
+ value="created-by"
+ >
+ <Accordion.Header>
+ <Accordion.Trigger
+ class="w-full flex items-center justify-between p-3 text-sm text-ink hover:bg-hover transition-colors outline-none group bg-surface mb-px"
+ onClick={(e) =>
+ scrollAccordionItemToTop(e, scrollRef())
+ }
+ >
+ <span class="font-medium">Created by</span>
+ <div class="flex items-center gap-2">
+ <Show when={createdByIds().length > 0}>
+ <span class="group-data-expanded:hidden size-4 flex items-center justify-center rounded-full bg-accent text-surface text-xxs font-medium leading-none">
+ {createdByIds().length}
+ </span>
+ </Show>
+ <ChevronDownIcon class="size-3.5 text-ink-muted transition-transform duration-200 group-data-expanded:rotate-180" />
+ </div>
+ </Accordion.Trigger>
+ </Accordion.Header>
+ <Accordion.Content>
+ <div class="flex items-center gap-2 px-3 py-2 muted bg-surface mb-px">
+ <SearchIcon class="size-3.5 text-ink-muted shrink-0" />
+ <input
+ type="text"
+ aria-label="Search creators"
+ value={createdBySearch()}
+ onInput={(e) =>
+ setCreatedBySearch(e.currentTarget.value)
+ }
+ placeholder="Search creators..."
+ class="flex-1 bg-transparent text-sm outline-none placeholder:text-ink-placeholder"
+ />
+ </div>
+ <div class="max-h-[calc(50*var(--dvh))] overflow-y-auto scrollbar-hidden">
+ <For each={filteredCreatedByOptions()}>
+ {(option) => {
+ const active = () =>
+ createdByIds().includes(option.id);
+ return (
+ <button
+ type="button"
+ role="checkbox"
+ aria-checked={active()}
+ class="w-full flex items-center gap-3 px-4 py-2.5 text-sm hover:bg-hover transition-colors text-left bg-surface not-last:mb-px"
+ onClick={() => toggleCreatedBy(option.id)}
+ >
+ <span
+ class={cn(
+ 'size-4 flex items-center justify-center shrink-0 rounded border transition-colors',
+ active()
+ ? 'bg-accent border-accent'
+ : 'border-edge'
+ )}
+ >
+ <Show when={active()}>
+ <CheckIcon class="size-2.5 text-surface" />
+ </Show>
+ </span>
+ <span class="size-4 flex items-center justify-center shrink-0">
+ {option.icon()}
+ </span>
+ <span
+ class={cn(
+ 'flex-1 truncate',
+ active() ? 'text-ink' : 'text-ink-muted'
+ )}
+ >
+ {option.label}
+ </span>
+ </button>
+ );
+ }}
+ </For>
+ </div>
+ <Show when={filteredCreatedByOptions().length === 0}>
+ <div class="px-4 py-2 text-sm text-ink-muted">
+ No results
+ </div>
+ </Show>
+ </Accordion.Content>
+ </MobileDrawer.Section>
+ </Show>
</Accordion>
</div>
</div>
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/searchable-multi-select.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/searchable-multi-select.tsx
index 93104454be..209c0d6953 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/searchable-multi-select.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/searchable-multi-select.tsx
@@ -127,37 +127,47 @@ const SearchableMultiSelectItem = (itemProps: {
);
const VirtualizedListbox = (props: {
- options: SearchableOption[];
class?: string;
onOnly?: (id: string) => void;
isSoleActive?: (id: string) => boolean;
}) => {
let handle: VirtualizerHandle | undefined;
+ // Kobalte supplies the collection after applying the combobox search
+ // filter. Use it for focus scrolling too — indexing the original options
+ // array targets the wrong virtual row whenever the list is filtered.
+ let visibleItems:
+ | Accessor<Iterable<CollectionNode<SearchableOption>>>
+ | undefined;
return (
<Combobox.Listbox<SearchableOption>
scrollToItem={(key) => {
- const idx = props.options.findIndex((o) => o.id === key);
+ const idx = Array.from(visibleItems?.() ?? []).findIndex(
+ (item) => item.rawValue.id === key
+ );
if (idx !== -1) handle?.scrollToIndex(idx, { align: 'nearest' });
}}
class={cn(LISTBOX_CLASS, props.class)}
>
- {(items) => (
- <Virtualizer
- ref={(h) => {
- handle = h;
- }}
- data={[...items()]}
- itemSize={ITEM_HEIGHT}
- >
- {(item) => (
- <SearchableMultiSelectItem
- item={item}
- onOnly={props.onOnly}
- isSoleActive={props.isSoleActive}
- />
- )}
- </Virtualizer>
- )}
+ {(items) => {
+ visibleItems = items;
+ return (
+ <Virtualizer
+ ref={(h) => {
+ handle = h;
+ }}
+ data={[...items()]}
+ itemSize={ITEM_HEIGHT}
+ >
+ {(item) => (
+ <SearchableMultiSelectItem
+ item={item}
+ onOnly={props.onOnly}
+ isSoleActive={props.isSoleActive}
+ />
+ )}
+ </Virtualizer>
+ );
+ }}
</Combobox.Listbox>
);
};
@@ -295,7 +305,6 @@ export const SearchableMultiSelect = (props: SearchableMultiSelectProps) => {
}
>
<VirtualizedListbox
- options={displayOptions()}
class={props.listboxClass}
onOnly={props.onOnly}
isSoleActive={isSoleActive}
@@ -417,10 +426,7 @@ export const SearchableMultiSelectInline = (
</div>
}
>
- <VirtualizedListbox
- options={sortedOptions()}
- class={props.listboxClass}
- />
+ <VirtualizedListbox class={props.listboxClass} />
</Show>
</div>
</Combobox>
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
index a0bcb117b9..8dfb1a6d0f 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/unified-filter-dropdown.tsx
@@ -593,6 +593,10 @@ export const UnifiedFilterDropdown = (
if (!view) return [];
const viewCategories = VIEW_FILTER_CATEGORIES[view] ?? [];
+ // The Folders tab only lists folders, so document-type refinements are
+ // inapplicable there.
+ if (view === 'documents' && activeTab() === 'folders') return [];
+
if (view !== 'inbox') return viewCategories;
return filterInboxGithubPrOption(
@@ -825,8 +829,67 @@ export const UnifiedFilterDropdown = (
};
const isTasksView = () => currentView() === 'tasks';
+ const isDocumentsView = () => currentView() === 'documents';
+ const isCreatedByFilterView = () => {
+ const view = currentView();
+ return view === 'documents' || view === 'tasks';
+ };
+ const showCreatedByFilter = () =>
+ isCreatedByFilterView() && !(isDocumentsView() && activeTab() === 'owned');
const isCompaniesView = () => currentView() === 'companies';
+ // The Files "Owned" tab has a creator constraint as part of its base
+ // preset. Keep that constraint when a user clears an explicit Created by
+ // selection, rather than accidentally broadening the tab to every file.
+ const baseCreatedByIds = createMemo(() => {
+ const view = currentView();
+ if (view !== 'documents' && view !== 'tasks') return [];
+ return (
+ getViewPreset(view, activeTab(), {
+ userId: userId(),
+ isTeamAdmin: false,
+ })?.filters.include?.documentOwnerId ?? []
+ );
+ });
+ const createdByIds = createMemo(
+ () => queryFilters.state.include.documentOwnerId ?? []
+ );
+
+ const createdByOptions = createMemo((): SearchableOption[] => {
+ const currentUserId = userId();
+ let meOption: SearchableOption | undefined;
+ const otherContactOptions: SearchableOption[] = [];
+ for (const contact of contacts()) {
+ const opt: SearchableOption = {
+ id: contact.id,
+ label: buildContactLabel(contact, currentUserId),
+ icon: () => (
+ <UserIcon
+ id={contact.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ };
+ if (contact.id === currentUserId) {
+ meOption = opt;
+ } else {
+ otherContactOptions.push(opt);
+ }
+ }
+ return [...(meOption ? [meOption] : []), ...otherContactOptions];
+ });
+
+ const handleCreatedByChange = (ids: string[]) => {
+ const nextIds = ids.length > 0 ? ids : baseCreatedByIds();
+ queryFilters.set({
+ include: {
+ documentOwnerId: nextIds.length > 0 ? nextIds : undefined,
+ },
+ });
+ };
+
const tagFilter = useTagFilter();
const showTagsFilter = () => {
const view = currentView();
@@ -904,7 +967,7 @@ export const UnifiedFilterDropdown = (
</Switch>
</Show>
- <Dropdown.Content class="shadow-menu">
+ <Dropdown.Content class={cn('shadow-menu min-w-32')}>
<Dropdown.Group>
<Show when={isNewInbox()}>
<ReadStatusSubmenu
@@ -915,12 +978,23 @@ export const UnifiedFilterDropdown = (
<Show
when={
categories().length === 1 &&
+ !isDocumentsView() &&
!isTasksView() &&
!isCompaniesView() &&
!isNewInbox()
}
fallback={
<>
+ <Show when={isDocumentsView() && showTagsFilter()}>
+ <SearchableFilterSubmenu
+ label="Tags"
+ options={tagFilter.options}
+ activeIds={tagFilter.activeIds}
+ onChange={tagFilter.onChange}
+ placeholder="Filter by tag..."
+ />
+ </Show>
+
<For each={categories()}>
{(category) => (
<Dropdown.Sub>
@@ -978,6 +1052,16 @@ export const UnifiedFilterDropdown = (
/>
</Show>
+ <Show when={showCreatedByFilter()}>
+ <SearchableFilterSubmenu
+ label="Created by"
+ options={createdByOptions}
+ activeIds={createdByIds}
+ onChange={handleCreatedByChange}
+ placeholder="Search creators..."
+ />
+ </Show>
+
{/* Stage + Owner filters for the Customers view */}
<Show when={isCompaniesView()}>
<SearchableFilterSubmenu
@@ -1032,7 +1116,7 @@ export const UnifiedFilterDropdown = (
</For>
</Show>
- <Show when={showTagsFilter()}>
+ <Show when={!isDocumentsView() && showTagsFilter()}>
<SearchableFilterSubmenu
label="Tags"
options={tagFilter.options}
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/use-filter-refinements.tsx b/apps/web/src/features/next-soup/soup-view/filters-bar/use-filter-refinements.tsx
index 89969ae7b1..9febb18f39 100644
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/use-filter-refinements.tsx
+++ b/apps/web/src/features/next-soup/soup-view/filters-bar/use-filter-refinements.tsx
@@ -288,6 +288,78 @@ export function useFilterRefinements() {
];
});
+ /** Creator options for the Tasks and Files Created by filter. */
+ const createdByOptionsMap = createMemo(
+ (): Map<string, { label: string; icon?: () => JSX.Element }> => {
+ const uid = currentUserId();
+ const map = new Map<
+ string,
+ { label: string; icon?: () => JSX.Element }
+ >();
+ for (const contact of contacts()) {
+ map.set(contact.id, {
+ label: buildContactLabel(contact, uid),
+ icon: () => (
+ <UserIcon
+ id={contact.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ });
+ }
+ return map;
+ }
+ );
+
+ const createdBySearchableOptions = createMemo((): SearchableOption[] => {
+ const uid = currentUserId();
+ let meOption: SearchableOption | undefined;
+ const otherContactOptions: SearchableOption[] = [];
+ for (const contact of contacts()) {
+ const option: SearchableOption = {
+ id: contact.id,
+ label: buildContactLabel(contact, uid),
+ icon: () => (
+ <UserIcon
+ id={contact.id}
+ size="sm"
+ suppressClick
+ showTooltip={false}
+ />
+ ),
+ };
+ if (contact.id === uid) {
+ meOption = option;
+ } else {
+ otherContactOptions.push(option);
+ }
+ }
+ return [...(meOption ? [meOption] : []), ...otherContactOptions];
+ });
+
+ // The Files "Owned" tab scopes its base query to the current creator.
+ // An empty explicit selection must restore that preset constraint instead
+ // of broadening the tab to all files.
+ const baseCreatedByIds = createMemo(
+ () => currentPreset()?.filters.include?.documentOwnerId ?? []
+ );
+ const createdByIds = createMemo(
+ () => filterData().include.documentOwnerId ?? []
+ );
+ const hasCreatedByRefinement = () =>
+ !deepEqual(createdByIds(), baseCreatedByIds());
+
+ const handleCreatedByChange = (ids: string[]) => {
+ const nextIds = ids.length > 0 ? ids : baseCreatedByIds();
+ queryFilters.set({
+ include: {
+ documentOwnerId: nextIds.length > 0 ? nextIds : undefined,
+ },
+ });
+ };
+
/**
* Handler for owner filter changes (Customers view). Client-side
* predicate only — companies come back from a dedicated capped CRM
@@ -353,8 +425,7 @@ export function useFilterRefinements() {
/**
* Handler for assignee filter changes.
*/
- const handleAssigneeChange = (ids: string[]) => {
- const current = assigneeFilter();
+ const handleAssigneeChange = (ids: string[], current = assigneeFilter()) => {
const toAdd = ids.filter((id) => !current.includes(id));
const toRemove = current.filter((id) => !ids.includes(id));
@@ -386,6 +457,29 @@ export function useFilterRefinements() {
});
};
+ // My Tasks has an implicit current-user assignee scope in its tab preset.
+ // Materialize it in the editable Assignee picker without adding a redundant
+ // property filter until the user changes that default selection.
+ const [myTasksAssigneeEdited, setMyTasksAssigneeEdited] = createSignal(false);
+ const isMyTasksTab = () =>
+ currentView() === 'tasks' && activeTab() === 'my-tasks';
+ const defaultMyTasksAssigneeIds = () => {
+ const id = currentUserId();
+ return isMyTasksTab() && id ? [id] : [];
+ };
+ const visibleAssigneeIds = () => {
+ const ids = assigneeFilter();
+ if (ids.length > 0 || myTasksAssigneeEdited()) return ids;
+ return defaultMyTasksAssigneeIds();
+ };
+ const handleVisibleAssigneeChange = (ids: string[]) => {
+ const current = visibleAssigneeIds();
+ if (isMyTasksTab() && !myTasksAssigneeEdited()) {
+ setMyTasksAssigneeEdited(true);
+ }
+ handleAssigneeChange(ids, current);
+ };
+
/**
* Get filter categories for the current view
*/
@@ -448,6 +542,7 @@ export function useFilterRefinements() {
labelPlural?: string;
allOptions: FilterValue[];
multiple: boolean;
+ showTabDefaults: boolean;
presetAndOptionIds: FilterID[];
presetOrOptionIds: FilterID[];
}
@@ -479,18 +574,22 @@ export function useFilterRefinements() {
}
const presetOptionIds = [...presetAndOptionIds, ...presetOrOptionIds];
+ const isMyTasksDefaultStatus =
+ view === 'tasks' && tab === 'my-tasks' && category.id === 'status';
if (
activeValues.length > 0 &&
- hasFilterCategoryRefinement(
- activeValues.map((value) => value.id),
- presetOptionIds
- )
+ (isMyTasksDefaultStatus ||
+ hasFilterCategoryRefinement(
+ activeValues.map((value) => value.id),
+ presetOptionIds
+ ))
) {
categoryGroups.set(category.id, {
label: category.label,
labelPlural: category.labelPlural,
allOptions,
multiple: category.multiple ?? true,
+ showTabDefaults: isMyTasksDefaultStatus,
presetAndOptionIds,
presetOrOptionIds,
});
@@ -513,6 +612,16 @@ export function useFilterRefinements() {
result.push(opt);
}
}
+ if (group.showTabDefaults) {
+ const order = new Map([
+ ['task-in-progress', 0],
+ ['task-not-started', 1],
+ ['task-in-review', 2],
+ ]);
+ result.sort(
+ (a, b) => (order.get(a.id) ?? 3) - (order.get(b.id) ?? 3)
+ );
+ }
return result;
};
@@ -582,7 +691,8 @@ export function useFilterRefinements() {
]);
const changes = [...categoryOptionIds].flatMap((id) => {
const wasActive = soup.predicates.isActive(id);
- const shouldBeActive = presetOptionIds.has(id);
+ const shouldBeActive =
+ !group.showTabDefaults && presetOptionIds.has(id);
return wasActive === shouldBeActive
? []
: [{ id, shouldBeActive }];
@@ -594,6 +704,12 @@ export function useFilterRefinements() {
const previousDocumentTypeIds = isDocumentTypeFilter
? getActiveDocumentTypeFilterIds(soup.predicates.isActive)
: undefined;
+ const nextPresetAndIds = group.showTabDefaults
+ ? []
+ : group.presetAndOptionIds;
+ const nextPresetOrIds = group.showTabDefaults
+ ? []
+ : group.presetOrOptionIds;
batch(() => {
soup.predicates.set(({ andIds, orIds }) => ({
@@ -601,13 +717,13 @@ export function useFilterRefinements() {
...andIds.filter(
(id) => !categoryOptionIds.has(id as FilterID)
),
- ...group.presetAndOptionIds,
+ ...nextPresetAndIds,
],
or: [
...orIds.filter(
(id) => !categoryOptionIds.has(id as FilterID)
),
- ...group.presetOrOptionIds,
+ ...nextPresetOrIds,
],
}));
@@ -647,14 +763,14 @@ export function useFilterRefinements() {
const key = 'assignee';
const popupOpen =
consolidatedChipCache.get(key)?.isPopupOpen?.() ?? false;
- const ids = assigneeFilter();
+ const ids = visibleAssigneeIds();
if (ids.length === 0 && !popupOpen) return;
seenKeys.add(key);
// Compute values as accessor for reactivity, including icons
const getValues = (): FilterValue[] =>
- assigneeFilter().map((id) => {
+ visibleAssigneeIds().map((id) => {
const opt = assigneeOptionsMap().get(id);
return {
id,
@@ -679,12 +795,56 @@ export function useFilterRefinements() {
categoryLabel: 'Assignee',
values: getValues,
searchableOptions: assigneeSearchableOptions,
- activeSearchableIds: assigneeFilter,
- onSearchableChange: handleAssigneeChange,
+ activeSearchableIds: visibleAssigneeIds,
+ onSearchableChange: handleVisibleAssigneeChange,
searchPlaceholder: 'Search assignees...',
isPopupOpen,
setPopupOpen,
- onRemoveAll: () => handleAssigneeChange([]),
+ onRemoveAll: () => handleVisibleAssigneeChange([]),
+ };
+ })
+ );
+ };
+
+ // Created by is a server-side document-owner filter shared by Tasks and
+ // Files. Unlike Assignee, it has no separate client predicate/state.
+ const pushCreatedByConsolidatedChip = () => {
+ if (view !== 'documents' && view !== 'tasks') return;
+ const key = 'created-by';
+ const popupOpen =
+ consolidatedChipCache.get(key)?.isPopupOpen?.() ?? false;
+ if (!hasCreatedByRefinement() && !popupOpen) return;
+
+ seenKeys.add(key);
+
+ const getValues = (): FilterValue[] =>
+ createdByIds().map((id) => {
+ const option = createdByOptionsMap().get(id);
+ return { id, label: option?.label ?? id, icon: option?.icon };
+ });
+
+ filters.push(
+ getOrCreateConsolidatedChip(key, () => {
+ const [isPopupOpen, _setPopupOpen] = createSignal(false);
+ const setPopupOpen = (open: boolean) => {
+ if (!open) {
+ queueMicrotask(() =>
+ panel.panelRef()?.focus({ preventScroll: true })
+ );
+ }
+ _setPopupOpen(open);
+ };
+ return {
+ key,
+ categoryLabel: 'Created by',
+ values: getValues,
+ searchableOptions: createdBySearchableOptions,
+ activeSearchableIds: createdByIds,
+ onSearchableChange: handleCreatedByChange,
+ searchPlaceholder: 'Search creators...',
+ isPopupOpen,
+ setPopupOpen,
+ onRemoveAll: () => handleCreatedByChange([]),
};
})
);
@@ -835,6 +995,7 @@ export function useFilterRefinements() {
};
pushAssigneeConsolidatedChip();
+ pushCreatedByConsolidatedChip();
pushStageConsolidatedChip();
pushOwnerConsolidatedChip();
pushTagsConsolidatedChip();
@@ -952,6 +1113,7 @@ export function useFilterRefinements() {
soup.predicates.set(preset.clientFilters);
queryFilters.replace(preset.filters ?? null);
setAssigneeFilter([]);
+ setMyTasksAssigneeEdited(false);
setOwnerFilter([]);
setStageFilter([]);
});
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
index 68df04c7de..b4db157f00 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-tabs.tsx
@@ -133,6 +133,23 @@ export const useApplyPreset = () => {
});
}
+ // Created by is a direct server-side document-owner refinement rather
+ // than a client predicate, so retain an explicit choice across the
+ // Tasks and Files tabs just as we do tags above. Do not carry a tab's
+ // own owner scope (e.g. Files → Owned) into another tab.
+ const currentCreatorIds =
+ queryFilters.state.include.documentOwnerId ?? [];
+ const presetCreatorIds =
+ currentPreset?.filters.include?.documentOwnerId ?? [];
+ const isExplicitCreatorFilter =
+ currentCreatorIds.length !== presetCreatorIds.length ||
+ currentCreatorIds.some((id) => !presetCreatorIds.includes(id));
+ if (isExplicitCreatorFilter) {
+ mergedFilters.include.documentOwnerId = currentCreatorIds.length
+ ? [...currentCreatorIds]
+ : undefined;
+ }
+
nextFilters = mergedFilters;
nextClientFilters = {