Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions js/app/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion js/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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: () => ({
Expand All @@ -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: {
Expand All @@ -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'] },
}),
},
},
Expand Down
5 changes: 5 additions & 0 deletions js/app/packages/app/component/next-soup/filters/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

const resolved = resolver(getPresetContext());
if (!resolved) return;
if (!resolved) return false;

setActiveTab(tabId);
applyPreset(resolved);
return true;
};

return { applyTabPreset };
Expand Down
25 changes: 22 additions & 3 deletions js/app/packages/app/component/next-soup/soup-view/soup-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const useSoupNotificationInvalidators = () => {
};

type PersistedSoupViewState = {
version?: number;
activeTab: string | undefined;
filters: { and: string[]; or: string[] };
queryFilters: SoupItemsQueryFilters;
Expand All @@ -155,6 +156,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>();
Expand Down Expand Up @@ -649,11 +652,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);
});
}
Comment thread
gbirman marked this conversation as resolved.
Resolved
batch(() => {
soup.filters.set(initialPersistedState.filters ?? { and: [], or: [] });
setQueryFilters(initialPersistedState.queryFilters ?? {});
soup.sort.setAll(initialPersistedState.sort ?? []);
setActiveTab(initialPersistedState.activeTab);
setAssigneeFilter(initialPersistedState.assigneeFilter ?? []);
});
} else {
Expand All @@ -667,6 +685,7 @@ export const SoupViewList = (props: SoupViewListProps) => {
on(
() =>
({
version: PERSISTED_STATE_VERSION,
activeTab: activeTab(),
filters: {
and: soup.filters.andFilters().map((f) => f.id),
Expand Down
Loading