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): combine created and assigned task view tabs (#5310)

dev-rb96c135c44dec
diff --git a/apps/web/src/features/next-soup/filters/configs/index.ts b/apps/web/src/features/next-soup/filters/configs/index.ts
index a2bfc24ebf..71a06dd843 100644
--- a/apps/web/src/features/next-soup/filters/configs/index.ts
+++ b/apps/web/src/features/next-soup/filters/configs/index.ts
@@ -59,6 +59,7 @@ import {
activeTaskFilter,
assignedToMeFilter,
assigneeFilter,
+ myTasksFilter,
TASK_PRIORITY_FILTERS,
TASK_STATUS_FILTERS,
} from './task';
@@ -86,6 +87,7 @@ export const SOUP_FILTERS = [
ownedEntityFilter,
assignedToMeFilter,
assigneeFilter,
+ myTasksFilter,
notTaskFilter,
documentOrFileFilter,
activeTaskFilter,
diff --git a/apps/web/src/features/next-soup/filters/configs/my-tasks.ts b/apps/web/src/features/next-soup/filters/configs/my-tasks.ts
new file mode 100644
index 0000000000..f1fa4ae921
--- /dev/null
+++ b/apps/web/src/features/next-soup/filters/configs/my-tasks.ts
@@ -0,0 +1,37 @@
+import type {
+ EntityData,
+ TaskEntityWithProperties,
+} from '@entity/types/entity';
+import { getTaskAssigneeIds } from '@entity/utils/task-properties';
+import type { Query } from '../filter-store';
+
+/** Whether a task is owned by or assigned to the current user. */
+export const isMyTask = (
+ entity: EntityData,
+ userId: string | undefined
+): boolean => {
+ if (
+ entity.type !== 'document' ||
+ entity.subType?.type !== 'task' ||
+ !userId
+ ) {
+ return false;
+ }
+
+ return (
+ entity.ownerId === userId ||
+ getTaskAssigneeIds(entity as TaskEntityWithProperties).includes(userId)
+ );
+};
+
+/** Server-side owner-or-assignee scope for the My tasks tab. */
+export const getMyTasksQuery = (userId: string): Query => ({
+ include: { subType: ['task'] },
+ documentWhere: {
+ op: 'or',
+ clauses: [
+ { include: { documentOwnerId: [userId] } },
+ { include: { documentImportance: true } },
+ ],
+ },
+});
diff --git a/apps/web/src/features/next-soup/filters/configs/task.ts b/apps/web/src/features/next-soup/filters/configs/task.ts
index af2a9cb9c7..f3bec80ba3 100644
--- a/apps/web/src/features/next-soup/filters/configs/task.ts
+++ b/apps/web/src/features/next-soup/filters/configs/task.ts
@@ -26,6 +26,7 @@ import {
type Predicate,
propFilter,
} from './base';
+import { getMyTasksQuery, isMyTask } from './my-tasks';
const statusFilter = <TId extends string>(
id: TId,
@@ -183,6 +184,12 @@ export const TASK_PRIORITY_FILTERS = [
taskNoPriorityFilter,
] as const;
+export const myTasksFilter = config({
+ id: 'my-tasks',
+ predicate: (e, ctx) => isMyTask(e, ctx.userId),
+ query: (ctx) => getMyTasksQuery(ctx.userId ?? ''),
+});
+
export const assignedToMeFilter = config({
id: 'assigned-to',
predicate: (e, ctx) => taskAssignedToUserPredicate(() => ctx.userId)(e),
diff --git a/apps/web/src/features/next-soup/filters/filter-store/compile.ts b/apps/web/src/features/next-soup/filters/filter-store/compile.ts
index e79149355b..cea3c0ef58 100644
--- a/apps/web/src/features/next-soup/filters/filter-store/compile.ts
+++ b/apps/web/src/features/next-soup/filters/filter-store/compile.ts
@@ -89,6 +89,7 @@ const FIELD_CONFIG: Record<
documentOwnerId: { target: 'df', field: 'o' },
documentSeen: { target: 'df', field: 'ns' },
documentDone: { target: 'df', field: 'nd' },
+ documentImportance: { target: 'df', field: 'imp' },
isEmailAttachment: { target: 'df', field: 'iea' },
calendarEventId: { target: 'calf', field: 'id' },
calendarEventSeen: { target: 'calf', field: 'ns' },
diff --git a/apps/web/src/features/next-soup/filters/filter-store/types.ts b/apps/web/src/features/next-soup/filters/filter-store/types.ts
index 7d489c2620..af64101536 100644
--- a/apps/web/src/features/next-soup/filters/filter-store/types.ts
+++ b/apps/web/src/features/next-soup/filters/filter-store/types.ts
@@ -77,6 +77,8 @@ export type ScalarFieldFilters = {
tagFilterMode?: TagFilterMode;
documentSeen?: boolean;
documentDone?: boolean;
+ /** For tasks, whether the current user is an assignee. */
+ documentImportance?: boolean;
isEmailAttachment?: boolean;
emailSeen?: boolean;
emailDone?: boolean;
@@ -128,6 +130,7 @@ export type DocumentFieldName =
| 'documentOwnerId'
| 'documentSeen'
| 'documentDone'
+ | 'documentImportance'
| 'isEmailAttachment'
| 'documentCreatedAt'
| 'documentUpdatedAt';
diff --git a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts
index a93137fea2..e15d6ef70e 100644
--- a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts
+++ b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.test.ts
@@ -18,6 +18,7 @@ afterEach(() => {
mocks.calendarUiEnabled = true;
});
+import { SYSTEM_PROPERTY_IDS } from '@property/constants';
import { compileToAst, queryStateFrom } from '../filters/filter-store/compile';
import { VIEW_TAB_LISTS } from '../soup-view/tab-lists';
import { getViewPreset, VIEW_TAB_PRESETS } from './soup-filter-presets';
@@ -32,6 +33,33 @@ describe('mail view presets', () => {
});
});
+describe('task view presets', () => {
+ const context = { userId: 'user-1', isTeamAdmin: false };
+
+ it('uses one My tasks tab for tasks owned by or assigned to the user', () => {
+ const preset = getViewPreset('tasks', 'my-tasks', context);
+
+ expect(VIEW_TAB_PRESETS.tasks.default).toBe('my-tasks');
+ expect(Object.keys(VIEW_TAB_PRESETS.tasks.tabs)).toEqual([
+ 'my-tasks',
+ 'all',
+ ]);
+ expect(preset?.clientFilters).toEqual({
+ and: ['task', 'my-tasks'],
+ or: ['task-not-started', 'task-in-progress', 'task-in-review'],
+ });
+ expect(preset?.groupBy).toBe(`property:${SYSTEM_PROPERTY_IDS.PRIORITY}`);
+ expect(compileToAst(queryStateFrom(preset?.filters ?? {})).df).toEqual({
+ '&': [
+ { l: { dst: 'task' } },
+ {
+ '|': [{ l: { o: 'user-1' } }, { l: { imp: true } }],
+ },
+ ],
+ });
+ });
+});
+
describe('calendar event scoping', () => {
it('excludes calendar events from views that do not render them', () => {
const nilId = '00000000-0000-0000-0000-000000000000';
diff --git a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
index da6b6359d7..075215b6a3 100644
--- a/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
+++ b/apps/web/src/features/next-soup/sidebar/soup-filter-presets.ts
@@ -1,5 +1,6 @@
import type { ListView } from '@app/constants/list-views';
import type { FilterID } from '@app/features/next-soup/filters';
+import { getMyTasksQuery } from '@app/features/next-soup/filters/configs/my-tasks';
import {
defineQueryFilters,
NIL_UUID,
@@ -352,46 +353,24 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
},
},
tasks: {
- default: 'assigned-to-me',
+ default: 'my-tasks',
tabs: {
- 'assigned-to-me': (ctx) => {
+ 'my-tasks': (ctx) => {
if (!ctx.userId) return undefined;
+ const myTasksQuery = getMyTasksQuery(ctx.userId);
return {
filters: defineQueryFilters({
+ ...myTasksQuery,
include: {
- subType: ['task'],
- properties: [
- {
- propertyId: SYSTEM_PROPERTY_IDS.ASSIGNEES,
- type: 'entity',
- value: ctx.userId,
- },
- ...OPEN_TASK_STATUS_INCLUDE_PROPS,
- ],
- },
- }),
- clientFilters: {
- and: ['task', 'assigned-to'],
- or: [...OPEN_TASK_STATUS_FILTER_IDS],
- },
- groupBy: `property:${SYSTEM_PROPERTY_IDS.PRIORITY}`,
- };
- },
- 'created-by-me': (ctx) => {
- if (!ctx.userId) return undefined;
- return {
- filters: defineQueryFilters({
- include: {
- subType: ['task'],
- documentOwnerId: [ctx.userId],
+ ...myTasksQuery.include,
properties: [...OPEN_TASK_STATUS_INCLUDE_PROPS],
},
}),
clientFilters: {
- and: ['task', 'owned-entity'],
+ and: ['task', 'my-tasks'],
or: [...OPEN_TASK_STATUS_FILTER_IDS],
},
- groupBy: `property:${SYSTEM_PROPERTY_IDS.STATUS}`,
+ groupBy: `property:${SYSTEM_PROPERTY_IDS.PRIORITY}`,
};
},
all: () => ({
@@ -399,7 +378,6 @@ export const VIEW_TAB_PRESETS: Record<ListView, ViewTabConfig> = {
include: { subType: ['task'] },
}),
clientFilters: { and: ['task'] },
- groupBy: `property:${SYSTEM_PROPERTY_IDS.ASSIGNEES}`,
}),
},
},
diff --git a/apps/web/src/features/next-soup/soup-view/filters-bar/task-status-filter.ts b/apps/web/src/features/next-soup/soup-view/filters-bar/task-status-filter.ts
deleted file mode 100644
index 9985bc84c4..0000000000
--- a/apps/web/src/features/next-soup/soup-view/filters-bar/task-status-filter.ts
+++ /dev/null
@@ -1,45 +0,0 @@
-import type { FilterID } from '@app/features/next-soup/filters';
-import type { Query } from '@app/features/next-soup/filters/filter-store';
-import { useSoupView } from '@app/features/next-soup/soup-view/soup-view-context';
-import { batch } from 'solid-js';
-
-export const TASK_STATUS_FILTER_IDS: FilterID[] = [
- 'task-not-started',
- 'task-in-progress',
- 'task-in-review',
- 'task-completed',
- 'task-canceled',
-];
-
-export function useTaskStatusFilter() {
- const { soup, queryFilters } = useSoupView();
-
- const statusQuery = (id: FilterID): Query | undefined => {
- const query = soup.predicates.getConfig(id)?.query;
- return query ? (query as Query) : undefined;
- };
-
- const setStatus = (id: FilterID, wasActive: boolean) => {
- soup.predicates.toggle({ or: [id] });
- const query = statusQuery(id);
- if (!query) return;
- if (wasActive) queryFilters.remove(query);
- else queryFilters.add(query);
- };
-
- const isActive = (id: FilterID) => soup.predicates.isActive(id);
-
- const clear = () =>
- batch(() => {
- for (const id of TASK_STATUS_FILTER_IDS) {
- if (isActive(id)) setStatus(id, true);
- }
- });
-
- const toggle = (id: FilterID) => {
- const active = isActive(id);
- batch(() => setStatus(id, active));
- };
-
- return { isActive, toggle, clear };
-}
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 008087bf40..5efa63d642 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
@@ -38,10 +38,6 @@ import type {
} from './consolidated-filter-chip';
import type { SearchableOption } from './searchable-multi-select';
import { useTagFilter } from './tag-filter';
-import {
- TASK_STATUS_FILTER_IDS,
- useTaskStatusFilter,
-} from './task-status-filter';
import {
buildContactLabel,
VIEW_FILTER_CATEGORIES,
@@ -62,6 +58,16 @@ const TAB_ONLY_FILTERS = new Set([
'not-task',
]);
+const hasFilterCategoryRefinement = (
+ activeIds: readonly string[],
+ presetIds: readonly string[]
+): boolean => {
+ const active = new Set(activeIds);
+ return (
+ active.size !== presetIds.length || presetIds.some((id) => !active.has(id))
+ );
+};
+
/**
* Hook that provides detection of active filter refinements beyond tab defaults,
* and a function to reset filters to the current tab's default state.
@@ -84,7 +90,6 @@ export function useFilterRefinements() {
const user = useUserContext();
const contacts = useContacts();
const currentUserId = useUserId();
- const taskStatus = useTaskStatusFilter();
const tagFilter = useTagFilter();
const dealStages = useDealStages();
@@ -428,15 +433,14 @@ export function useFilterRefinements() {
lastCacheTab = tab;
}
- const presetFilterIds = new Set([
- ...(preset?.clientFilters.and ?? []),
- ...(preset?.clientFilters.or ?? []),
- ]);
+ const presetAndFilterIds = new Set(preset?.clientFilters.and ?? []);
+ const presetOrFilterIds = new Set(preset?.clientFilters.or ?? []);
const filters: ConsolidatedFilter[] = [];
const seenKeys = new Set<string>();
- // Group view category filters by category
+ // Group view category filters by category. A category is a refinement only
+ // when its effective selection differs from the current tab's baseline.
const categoryGroups = new Map<
string,
{
@@ -444,42 +448,51 @@ export function useFilterRefinements() {
labelPlural?: string;
allOptions: FilterValue[];
multiple: boolean;
+ presetAndOptionIds: FilterID[];
+ presetOrOptionIds: FilterID[];
}
>();
for (const category of viewCategories()) {
- // Status has a dedicated chip below.
- if (view === 'tasks' && category.id === 'status') continue;
-
const activeValues: FilterValue[] = [];
const allOptions: FilterValue[] = [];
+ const presetAndOptionIds: FilterID[] = [];
+ const presetOrOptionIds: FilterID[] = [];
for (const option of category.options) {
- allOptions.push({
+ const value = {
id: option.id,
label: option.label,
icon: option.icon,
- });
+ };
+ allOptions.push(value);
+
+ if (TAB_ONLY_FILTERS.has(option.id)) continue;
- if (
- soup.predicates.isActive(option.id) &&
- !TAB_ONLY_FILTERS.has(option.id) &&
- !presetFilterIds.has(option.id as FilterID)
- ) {
- activeValues.push({
- id: option.id,
- label: option.label,
- icon: option.icon,
- });
+ if (soup.predicates.isActive(option.id)) activeValues.push(value);
+ if (presetAndFilterIds.has(option.id as FilterID)) {
+ presetAndOptionIds.push(option.id as FilterID);
+ }
+ if (presetOrFilterIds.has(option.id as FilterID)) {
+ presetOrOptionIds.push(option.id as FilterID);
}
}
- if (activeValues.length > 0) {
+ const presetOptionIds = [...presetAndOptionIds, ...presetOrOptionIds];
+ if (
+ activeValues.length > 0 &&
+ hasFilterCategoryRefinement(
+ activeValues.map((value) => value.id),
+ presetOptionIds
+ )
+ ) {
categoryGroups.set(category.id, {
label: category.label,
labelPlural: category.labelPlural,
allOptions,
multiple: category.multiple ?? true,
+ presetAndOptionIds,
+ presetOrOptionIds,
});
}
}
@@ -489,14 +502,13 @@ export function useFilterRefinements() {
const key = `category:${categoryId}`;
seenKeys.add(key);
- // Helper to get current active values for this category (computed fresh)
+ // Helper to get current active values for this category (computed fresh).
const getActiveValues = (): FilterValue[] => {
const result: FilterValue[] = [];
for (const opt of group.allOptions) {
if (
soup.predicates.isActive(opt.id) &&
- !TAB_ONLY_FILTERS.has(opt.id) &&
- !presetFilterIds.has(opt.id as FilterID)
+ !TAB_ONLY_FILTERS.has(opt.id)
) {
result.push(opt);
}
@@ -514,6 +526,8 @@ export function useFilterRefinements() {
multiple: group.multiple,
isValueActive: (id) => soup.predicates.isActive(id),
onToggleValue: (id) => {
+ const filterId = id as FilterID;
+ const wasActive = soup.predicates.isActive(filterId);
const isInboxTypeFilter =
currentView() === 'inbox' && categoryId === 'type';
const isDocumentTypeFilter =
@@ -523,7 +537,12 @@ export function useFilterRefinements() {
: undefined;
batch(() => {
- soup.predicates.toggle({ or: [id as FilterID] });
+ soup.predicates.set(({ andIds, orIds }) => ({
+ and: andIds.filter((currentId) => currentId !== filterId),
+ or: wasActive
+ ? orIds.filter((currentId) => currentId !== filterId)
+ : [...orIds, filterId],
+ }));
if (isInboxTypeFilter) {
const activeTypeIds = group.allOptions
@@ -545,19 +564,29 @@ export function useFilterRefinements() {
return;
}
- const query = getFilterQuery(id);
+ const query = getFilterQuery(filterId);
if (!query) return;
-
- if (soup.predicates.isActive(id)) {
- queryFilters.add(query);
- } else {
- queryFilters.remove(query);
- }
+ if (wasActive) queryFilters.remove(query);
+ else queryFilters.add(query);
});
},
onRemoveAll: () => {
- // Compute current active values at removal time
- const currentValues = getActiveValues();
+ const categoryOptionIds = new Set(
+ group.allOptions
+ .filter((option) => !TAB_ONLY_FILTERS.has(option.id))
+ .map((option) => option.id as FilterID)
+ );
+ const presetOptionIds = new Set([
+ ...group.presetAndOptionIds,
+ ...group.presetOrOptionIds,
+ ]);
+ const changes = [...categoryOptionIds].flatMap((id) => {
+ const wasActive = soup.predicates.isActive(id);
+ const shouldBeActive = presetOptionIds.has(id);
+ return wasActive === shouldBeActive
+ ? []
+ : [{ id, shouldBeActive }];
+ });
const isInboxTypeFilter =
currentView() === 'inbox' && categoryId === 'type';
const isDocumentTypeFilter =
@@ -567,12 +596,25 @@ export function useFilterRefinements() {
: undefined;
batch(() => {
- for (const value of currentValues) {
- soup.predicates.toggle({ or: [value.id as FilterID] });
- }
+ soup.predicates.set(({ andIds, orIds }) => ({
+ and: [
+ ...andIds.filter(
+ (id) => !categoryOptionIds.has(id as FilterID)
+ ),
+ ...group.presetAndOptionIds,
+ ],
+ or: [
+ ...orIds.filter(
+ (id) => !categoryOptionIds.has(id as FilterID)
+ ),
+ ...group.presetOrOptionIds,
+ ],
+ }));
if (isInboxTypeFilter) {
- queryFilters.replace(getInboxTypeQuery([]) ?? null);
+ queryFilters.replace(
+ getInboxTypeQuery([...presetOptionIds]) ?? null
+ );
return;
}
@@ -588,9 +630,11 @@ export function useFilterRefinements() {
return;
}
- for (const value of currentValues) {
- const query = getFilterQuery(value.id);
- if (query) queryFilters.remove(query);
+ for (const change of changes) {
+ const query = getFilterQuery(change.id);
+ if (!query) continue;
+ if (change.shouldBeActive) queryFilters.add(query);
+ else queryFilters.remove(query);
}
});
},
@@ -598,43 +642,6 @@ export function useFilterRefinements() {
);
}
- // Dedicated chip: the generic builder would hide the preset-seeded default.
- const pushTaskStatusChip = () => {
- if (view !== 'tasks') return;
- const statusCategory = viewCategories().find((c) => c.id === 'status');
- if (!statusCategory) return;
-
- const allOptions: FilterValue[] = statusCategory.options.map((o) => ({
- id: o.id,
- label: o.label,
- icon: o.icon,
- }));
-
- const getActiveValues = (): FilterValue[] =>
- allOptions.filter((o) => taskStatus.isActive(o.id as FilterID));
-
- // No chip when not narrowed (empty, or all selected = no filter).
- const activeCount = getActiveValues().length;
- if (activeCount === 0 || activeCount === allOptions.length) return;
-
- const key = 'status';
- seenKeys.add(key);
-
- filters.push(
- getOrCreateConsolidatedChip(key, () => ({
- key,
- categoryLabel: 'Status',
- categoryLabelPlural: 'Statuses',
- values: getActiveValues,
- availableOptions: allOptions,
- multiple: true,
- isValueActive: (id) => taskStatus.isActive(id as FilterID),
- onToggleValue: (id) => taskStatus.toggle(id as FilterID),
- onRemoveAll: () => taskStatus.clear(),
- }))
- );
- };
-
// Assignee filter (consolidated) - using searchable approach
const pushAssigneeConsolidatedChip = () => {
const key = 'assignee';
@@ -827,7 +834,6 @@ export function useFilterRefinements() {
);
};
- pushTaskStatusChip();
pushAssigneeConsolidatedChip();
pushStageConsolidatedChip();
pushOwnerConsolidatedChip();
@@ -942,18 +948,12 @@ export function useFilterRefinements() {
const preset = currentPreset();
if (!preset) return;
- // "Clear all" empties the status filter rather than restoring the default subset.
- const presetSeedsStatusSubset = (preset.clientFilters.or ?? []).some((id) =>
- TASK_STATUS_FILTER_IDS.includes(id as FilterID)
- );
-
batch(() => {
soup.predicates.set(preset.clientFilters);
queryFilters.replace(preset.filters ?? null);
setAssigneeFilter([]);
setOwnerFilter([]);
setStageFilter([]);
- if (presetSeedsStatusSubset) taskStatus.clear();
});
};
diff --git a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
index 57de992119..1dd339efe6 100644
--- a/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
+++ b/apps/web/src/features/next-soup/soup-view/soup-view-context.tsx
@@ -203,18 +203,19 @@ interface SoupViewContextProviderProps extends SoupViewInitializeOptions {
initialEnabled?: boolean;
}
-type PersistedViewQueryFilters =
- | QueryState
- | Partial<Record<string, QueryState>>;
type PersistedQueryFilters = Partial<
- Record<ListView, PersistedViewQueryFilters>
+ Record<ListView, Partial<Record<string, QueryState>>>
>;
+const SOUP_VIEW_PERSISTENCE_VERSION = 2;
+const soupViewPersistenceKey = (name: string) =>
+ `${name}-v${SOUP_VIEW_PERSISTENCE_VERSION}`;
+
// Shared by every split so one provider cannot overwrite another provider's
// saved views with a stale local copy of the persisted map.
const [persistedQueryFilters, setPersistedQueryFilters] = makePersisted(
createSignal<PersistedQueryFilters>({}),
- { name: 'soup-view-query-filters' }
+ { name: soupViewPersistenceKey('soup-view-query-filters') }
);
const [persistedPredicates, setPersistedPredicates] = makePersisted(
@@ -223,30 +224,18 @@ const [persistedPredicates, setPersistedPredicates] = makePersisted(
Record<ListView, Partial<Record<string, SetPredicatesInput<string>>>>
>
>({}),
- { name: 'soup-view-predicates' }
+ { name: soupViewPersistenceKey('soup-view-predicates') }
);
const [persistedActiveTabs, setPersistedActiveTabs] = makePersisted(
createSignal<Partial<Record<ListView, string>>>({}),
- { name: 'soup-view-active-tabs' }
+ { name: soupViewPersistenceKey('soup-view-active-tabs') }
);
-const isQueryState = (value: unknown): value is QueryState =>
- typeof value === 'object' &&
- value !== null &&
- 'include' in value &&
- 'exclude' in value;
-
const persistedQueryFor = (
view: ListView,
tabId: string
-): QueryState | undefined => {
- const saved = persistedQueryFilters()[view];
- if (!saved) return;
-
- // Migrate the previous per-view shape by using it as the first restored tab.
- return isQueryState(saved) ? saved : saved[tabId];
-};
+): QueryState | undefined => persistedQueryFilters()[view]?.[tabId];
/** Resolve a remembered tab id against the view's current tabs.
*
@@ -398,19 +387,13 @@ export const SoupViewContextProvider: FlowComponent<
const tabId = activeTab() ?? VIEW_TAB_PRESETS[view].default;
const snapshot = structuredClone(unwrap(store.state)) as QueryState;
- setPersistedQueryFilters((current) => {
- const savedForView = current[view];
- const filtersByTab =
- savedForView && !isQueryState(savedForView) ? savedForView : {};
-
- return {
- ...current,
- [view]: {
- ...filtersByTab,
- [tabId]: snapshot,
- },
- };
- });
+ setPersistedQueryFilters((current) => ({
+ ...current,
+ [view]: {
+ ...current[view],
+ [tabId]: snapshot,
+ },
+ }));
};
const queryFilters: QueryStore = {
@@ -475,21 +458,21 @@ export const SoupViewContextProvider: FlowComponent<
useEntryState<string[]>('soup.assigneeFilter', { default: [] }),
{
enabled: filterPersistenceEnabled,
- name: 'soup-view-assignee-filter',
+ name: soupViewPersistenceKey('soup-view-assignee-filter'),
}
);
const [ownerFilter, setOwnerFilter] = makeFlaggedPersisted(
useEntryState<string[]>('soup.ownerFilter', { default: [] }),
{
enabled: filterPersistenceEnabled,
- name: 'soup-view-owner-filter',
+ name: soupViewPersistenceKey('soup-view-owner-filter'),
}
);
const [stageFilter, setStageFilter] = makeFlaggedPersisted(
useEntryState<string[]>('soup.stageFilter', { default: [] }),
{
enabled: filterPersistenceEnabled,
- name: 'soup-view-stage-filter',
+ name: soupViewPersistenceKey('soup-view-stage-filter'),
}
);
const [inboxFilter, setInboxFilter] = makeFlaggedPersisted(
@@ -498,7 +481,7 @@ export const SoupViewContextProvider: FlowComponent<
}),
{
enabled: filterPersistenceEnabled,
- name: 'soup-view-inbox-filter',
+ name: soupViewPersistenceKey('soup-view-inbox-filter'),
}
);
@@ -616,7 +599,7 @@ export const SoupViewContextProvider: FlowComponent<
useEntryState<ReadFilter>('soup.readFilter', { default: 'unread' }),
{
enabled: filterPersistenceEnabled,
- name: 'soup-view-read-filter',
+ name: soupViewPersistenceKey('soup-view-read-filter'),
}
);
diff --git a/apps/web/src/features/next-soup/soup-view/tab-lists.ts b/apps/web/src/features/next-soup/soup-view/tab-lists.ts
index c6bb1efad0..fabe5dc565 100644
--- a/apps/web/src/features/next-soup/soup-view/tab-lists.ts
+++ b/apps/web/src/features/next-soup/soup-view/tab-lists.ts
@@ -46,8 +46,7 @@ export const VIEW_TAB_LISTS: Record<TabbedListView, TabItem[]> = {
{ value: 'all', label: 'All' },
],
tasks: [
- { value: 'assigned-to-me', label: 'Assigned' },
- { value: 'created-by-me', label: 'Created' },
+ { value: 'my-tasks', label: 'My tasks' },
{ value: 'all', label: 'All' },
],
channels: [