diff --git a/client/src/components/Conversations/ProjectsSection.tsx b/client/src/components/Conversations/ProjectsSection.tsx
index ff1591849e..28e19c6aad 100644
--- a/client/src/components/Conversations/ProjectsSection.tsx
+++ b/client/src/components/Conversations/ProjectsSection.tsx
@@ -370,12 +370,14 @@ const ProjectItem = memo(
-
+
{
localStorage.clear();
});
- it('lists project chats under Chats by default', () => {
- expect(createStore().get(showProjectChatsAtom)).toBe(true);
+ it('keeps project chats out of Chats by default', () => {
+ expect(createStore().get(showProjectChatsAtom)).toBe(false);
});
- it('counts hiding them as one change the menu badge and Reset own', () => {
+ it('counts listing them as one change the menu badge and Reset own', () => {
const store = createStore();
- store.set(showProjectChatsAtom, false);
+ store.set(showProjectChatsAtom, true);
expect(store.get(chatFilterCountAtom)).toBe(1);
store.set(resetChatFiltersAtom);
- expect(store.get(showProjectChatsAtom)).toBe(true);
+ expect(store.get(showProjectChatsAtom)).toBe(false);
expect(store.get(chatFilterCountAtom)).toBe(0);
});
@@ -59,12 +59,12 @@ describe('showProjectChatsAtom', () => {
return value as boolean;
};
- it('keeps the choice to hide them across visits', () => {
- expect(onNextVisit(false)).toBe(false);
+ it('keeps the choice to list them across visits', () => {
+ expect(onNextVisit(true)).toBe(true);
});
it('reads a stored value that is not a boolean as the default', () => {
- expect(onNextVisit('no')).toBe(true);
+ expect(onNextVisit('yes')).toBe(false);
});
});
diff --git a/client/src/components/Conversations/chatFilters.ts b/client/src/components/Conversations/chatFilters.ts
index 71fd8cb055..48da553516 100644
--- a/client/src/components/Conversations/chatFilters.ts
+++ b/client/src/components/Conversations/chatFilters.ts
@@ -66,13 +66,13 @@ export const chatSortAtom = atom(
},
);
-const storedShowProjectChatsAtom = createStorageAtom('chatListShowProjectChats', true);
+const storedShowProjectChatsAtom = createStorageAtom('chatListShowProjectChats', false);
-/** Whether chats filed in a project also list under Chats, where recent work is looked
- * for first. A display preference, so it is kept like the sort; anything but an explicit
- * `false` reads as the default. */
+/** Whether chats filed in a project also list under Chats. Off by default, so a chat is
+ * shown once, under its project. A display preference, so it is kept like the sort;
+ * anything but an explicit `true` reads as the default. */
export const showProjectChatsAtom = atom(
- (get) => get(storedShowProjectChatsAtom) !== false,
+ (get) => get(storedShowProjectChatsAtom) === true,
(_get, set, next: boolean) => {
set(storedShowProjectChatsAtom, next);
},
@@ -93,7 +93,7 @@ export const chatFilterCountAtom = atom((get) => {
if (sort.field !== DEFAULT_CHAT_SORT.field || sort.direction !== DEFAULT_CHAT_SORT.direction) {
count += 1;
}
- if (!get(showProjectChatsAtom)) {
+ if (get(showProjectChatsAtom)) {
count += 1;
}
return count;
@@ -103,7 +103,7 @@ export const resetChatFiltersAtom = atom(null, (_get, set) => {
set(chatFilterStatusAtom, 'active');
set(chatFilterTagsAtom, []);
set(storedChatSortAtom, DEFAULT_CHAT_SORT);
- set(storedShowProjectChatsAtom, true);
+ set(storedShowProjectChatsAtom, false);
});
/**
diff --git a/client/src/components/UnifiedSidebar/ConversationsSection.tsx b/client/src/components/UnifiedSidebar/ConversationsSection.tsx
index 0867623026..69f75fa96c 100644
--- a/client/src/components/UnifiedSidebar/ConversationsSection.tsx
+++ b/client/src/components/UnifiedSidebar/ConversationsSection.tsx
@@ -70,9 +70,9 @@ const ConversationsSection = memo(() => {
* projects are loading or failed to load, an empty Chats list claims no more than
* that nothing sits outside a project. */
const hasProjects = !projectsLoaded || (projectsData?.pages[0]?.projects?.length ?? 0) > 0;
- /** Project chats list under Chats too, badged with their folder, because Chats is where
- * recent work is looked for first. Turning that off shows each one only under its
- * project. Search and the archived view stay whole either way: both are places the user
+ /** By default each project chat shows only under its project. Turning the preference on
+ * lists it under Chats too, badged with its folder, for users who look for recent work
+ * there first. Search and the archived view stay whole either way: both are places the user
* goes to find something, and a project chat that appears in neither list nor result
* would have no way back. So does a list whose projects failed to load, which would
* otherwise hide every project chat behind a section that cannot show them. */
diff --git a/client/src/components/UnifiedSidebar/__tests__/ConversationsSection.spec.tsx b/client/src/components/UnifiedSidebar/__tests__/ConversationsSection.spec.tsx
index 2fb4665037..e889ef4c7e 100644
--- a/client/src/components/UnifiedSidebar/__tests__/ConversationsSection.spec.tsx
+++ b/client/src/components/UnifiedSidebar/__tests__/ConversationsSection.spec.tsx
@@ -310,32 +310,30 @@ describe('ConversationsSection project chats', () => {
});
afterEach(() => {
- act(() => getDefaultStore().set(showProjectChatsAtom, true));
+ act(() => getDefaultStore().set(showProjectChatsAtom, false));
});
- /** Chats is where recent work is looked for first, so a chat filed in a project is
- * listed there too, carrying its folder badge. */
- it('lists project chats under Chats by default', async () => {
+ /** A project chat is shown only under its project, not twice, unless the user opts in. */
+ it('asks only for chats that belong to no project by default', async () => {
renderSection();
await settleRenders();
expect(mockListParams).toHaveBeenCalled();
- expect(mockListParams.mock.calls.at(-1)?.[0]).toMatchObject({ projectId: undefined });
+ expect(mockListParams.mock.calls.at(-1)?.[0]).toMatchObject({ projectId: 'unassigned' });
});
- /** Turned off, a project chat is shown only under its project, not twice. */
- it('asks only for chats that belong to no project once project chats are hidden', async () => {
- act(() => getDefaultStore().set(showProjectChatsAtom, false));
+ /** Turned on, a chat filed in a project is listed under Chats too, with its folder badge. */
+ it('lists project chats under Chats once they are shown', async () => {
+ act(() => getDefaultStore().set(showProjectChatsAtom, true));
renderSection();
await settleRenders();
- expect(mockListParams.mock.calls.at(-1)?.[0]).toMatchObject({ projectId: 'unassigned' });
+ expect(mockListParams.mock.calls.at(-1)?.[0]).toMatchObject({ projectId: undefined });
});
/** Searching is how a chat is found, and Projects is not rendered while a search
* is on: excluding project chats there would make them unreachable. */
it('searches across every chat, project or not', async () => {
- act(() => getDefaultStore().set(showProjectChatsAtom, false));
let setSearch: SetterOrUpdater;
function SearchController() {
@@ -388,7 +386,7 @@ describe('ConversationsSection empty Chats wording', () => {
});
afterEach(() => {
- act(() => getDefaultStore().set(showProjectChatsAtom, true));
+ act(() => getDefaultStore().set(showProjectChatsAtom, false));
});
it('calls the account empty only once its projects have loaded and there are none', async () => {
diff --git a/e2e/specs/mock/scenarios/chat-filter-menu.spec.ts b/e2e/specs/mock/scenarios/chat-filter-menu.spec.ts
index c9a9930af6..94914bbe3d 100644
--- a/e2e/specs/mock/scenarios/chat-filter-menu.spec.ts
+++ b/e2e/specs/mock/scenarios/chat-filter-menu.spec.ts
@@ -238,7 +238,7 @@ test.describe('chat list properties menu', () => {
await expect(trigger(page)).toHaveAttribute('aria-label', 'Filters active: 2');
});
- test('a project chat is listed in Chats with its folder and under its project, hides from Chats on request, and stays reachable from the archive @scenario:project-chat-listed-in-chats-and-project', async ({
+ test('a project chat is left to its project by default, is listed in Chats with its folder on request, and stays reachable from the archive @scenario:project-chat-listed-in-chats-and-project', async ({
page,
}) => {
const projectName = `Menu project ${randomUUID().slice(0, 8)}`;
@@ -255,7 +255,7 @@ test.describe('chat list properties menu', () => {
await showSidebar(page);
await expect(chatsRow(page, unassigned)).toBeVisible();
- await expect(chatsRow(page, inProject).getByTestId('convo-project-badge')).toBeVisible();
+ await expect(chatsRow(page, inProject)).toHaveCount(0);
const projectRow = page.getByRole('button', { name: projectName }).first();
if ((await projectRow.getAttribute('aria-expanded')) !== 'true') {
@@ -270,7 +270,7 @@ test.describe('chat list properties menu', () => {
await trigger(page).click();
await page.getByRole('menuitemcheckbox', { name: 'Show project chats' }).click();
await closeMenus(page);
- await expect(chatsRow(page, inProject)).toHaveCount(0);
+ await expect(chatsRow(page, inProject).getByTestId('convo-project-badge')).toBeVisible();
await expect(chatsRow(page, unassigned)).toBeVisible();
await expect(trigger(page)).toHaveAttribute('aria-label', 'Filters active: 1');