The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): Pinned names the filter that hides every pin
kshitijk4poor40804ce4074c
diff --git a/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsx b/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsxindex a9d4df3afc1..f692cc8db1f 100644--- a/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsx+++ b/apps/desktop/src/app/chat/sidebar/chat-sidebar.integration.test.tsx@@ -8,7 +8,15 @@ import { $layoutTree, noteActiveTreeGroup } from '@/components/pane-shell/tree/simport { SidebarProvider } from '@/components/ui/sidebar'import { registry } from '@/contrib/registry'import { $connectionsRegistry } from '@/store/connection-registry-state'-import { $sidebarMessagingOpenIds, setSidebarAgentsGrouped, setSidebarGrouping } from '@/store/layout'+import {+ $pinnedSessionIds,+ $sidebarMessagingOpenIds,+ $sidebarProjectFilter,+ $sidebarShowArchived,+ $sidebarStatusFilter,+ setSidebarAgentsGrouped,+ setSidebarGrouping+} from '@/store/layout'import { $activeGatewayProfile, $profiles, setShowAllProfiles } from '@/store/profile'import { $projectScope, ALL_PROJECTS } from '@/store/project-scope'import { $projectTree } from '@/store/projects'@@ -225,6 +233,61 @@ describe('ChatSidebar cold-start load failure', () => {})})+// #146510: see SidebarPinnedEmptyState.+describe('ChatSidebar pinned empty state under filters', () => {+ beforeEach(() => {+ $sessions.set(sessionRows)+ $sessionsLoading.set(false)+ })++ afterEach(() => {+ cleanup()+ $sidebarStatusFilter.set([])+ $sidebarProjectFilter.set([])+ $sidebarShowArchived.set(false)+ $pinnedSessionIds.set([])+ $sessions.set([])+ $sessionsLoading.set(true)+ })++ it('names the filter when it hides every pin', () => {+ $sessions.set([{ ...sessionRows[0], pinned: true }, sessionRows[1]])+ $pinnedSessionIds.set(['tile-one'])+ $sidebarStatusFilter.set(['working'])++ renderSidebar('/', 'chat')++ expect(screen.queryByText('Tile one')).toBeNull()+ expect(screen.queryByText('Shift-click a chat to pin')).toBeNull()+ // Pinned and Sessions both report the filter.+ expect(screen.getAllByText('No sessions match these filters')).toHaveLength(2)+ })++ it('keeps the pin hint when nothing is pinned and no filter is on', () => {+ renderSidebar('/', 'chat')++ expect(screen.getByText('Shift-click a chat to pin')).toBeTruthy()+ expect(screen.queryByText('No sessions match these filters')).toBeNull()+ })++ it('keeps the pin hint when the only filter is a project id the tree does not resolve', () => {+ $sidebarProjectFilter.set(['/repos/gone'])++ renderSidebar('/', 'chat')++ expect(screen.getByText('Shift-click a chat to pin')).toBeTruthy()+ })++ it('drops the pin hint in the Archived view when Pinned is empty', () => {+ $sidebarShowArchived.set(true)++ renderSidebar('/', 'chat')++ expect(screen.queryByText('Shift-click a chat to pin')).toBeNull()+ expect(screen.getAllByText('No sessions match these filters')).toHaveLength(2)+ })+})+// Entering a project is a scope switch: the conversation main is showing keeps// its workspace, so Files/Review and the composer's Git context can't drift to// the project while the transcript stays on the old chat (#72772).diff --git a/apps/desktop/src/app/chat/sidebar/index.tsx b/apps/desktop/src/app/chat/sidebar/index.tsxindex 270356ebbe4..af11f540d23 100644--- a/apps/desktop/src/app/chat/sidebar/index.tsx+++ b/apps/desktop/src/app/chat/sidebar/index.tsx@@ -1764,7 +1764,7 @@ export function ChatSidebar({card={cardRows}contentClassName="flex flex-col gap-px rounded-lg pb-2 pt-1"dndSensors={dndSensors}- emptyState={<SidebarPinnedEmptyState />}+ emptyState={<SidebarPinnedEmptyState archived={showArchived} filtered={filtersNarrow} />}label={s.pinned}onArchiveSession={onArchiveSession}onBranchSession={onBranchSession}diff --git a/apps/desktop/src/app/chat/sidebar/section-states.tsx b/apps/desktop/src/app/chat/sidebar/section-states.tsxindex 3d1058034be..62ba259c668 100644--- a/apps/desktop/src/app/chat/sidebar/section-states.tsx+++ b/apps/desktop/src/app/chat/sidebar/section-states.tsx@@ -67,7 +67,13 @@ export function SidebarBlankState({ onNewProject }: { onNewProject: () => void })}-export function SidebarPinnedEmptyState() {+// Pinned resolves against the filtered list, so a filter can hide every pin.+// Say so, like the Sessions section does: the shift-click hint reads as "you+// have no pins" to someone whose pins are all still there (#146510).+// `filtered` is whether a filter actually narrows the list, not whether any+// selection is persisted: a stale project id narrows nothing. `archived` is the+// Archived view, which swaps the pool Pinned resolves from.+export function SidebarPinnedEmptyState({ archived, filtered }: { archived: boolean; filtered: boolean }) {const { t } = useI18n()return (@@ -75,7 +81,7 @@ export function SidebarPinnedEmptyState() {<span className="grid w-3.5 shrink-0 place-items-center text-(--ui-text-quaternary)"><Codicon name="pin" size="0.75rem" /></span>- <span>{t.sidebar.shiftClickHint}</span>+ <span>{filtered || archived ? t.sidebar.noFilterMatches : t.sidebar.shiftClickHint}</span></div>)}