Skip to content

The agent that grows with you

refactor(desktop): workspace lanes read the show-all preference at the leaf

teknium1e5d57c7fc551
diff --git a/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx b/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx
index 0ede7d4fe2e..ad970ec0ddd 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/entered-content.tsx
@@ -37,8 +37,7 @@ export function EnteredProjectContent({
onNewSessionSplit,
repoWorktrees,
liveSessions,
- removedSessionIds,
- showAllSessions = false
+ removedSessionIds
}: {
project: SidebarProjectTree
renderRows: (sessions: SessionInfo[]) => React.ReactNode
@@ -47,8 +46,6 @@ export function EnteredProjectContent({
repoWorktrees?: Record<string, HermesGitWorktree[]>
liveSessions?: SessionInfo[]
removedSessionIds?: ReadonlySet<string>
- /** Bypass the lane's ordinary five-session page when the sidebar preference is enabled. */
- showAllSessions?: boolean
}) {
if (!project.repos.length) {
return null
@@ -75,7 +72,6 @@ export function EnteredProjectContent({
renderRows={renderRows}
repo={repo}
showHeader={!single}
- showAllSessions={showAllSessions}
/>
))}
</>
@@ -90,8 +86,7 @@ function RepoFlatSection({
onNewSessionSplit,
discoveredWorktrees,
liveSessions,
- removedSessionIds,
- showAllSessions
+ removedSessionIds
}: {
repo: SidebarWorkspaceTree
showHeader: boolean
@@ -101,7 +96,6 @@ function RepoFlatSection({
discoveredWorktrees?: HermesGitWorktree[]
liveSessions?: SessionInfo[]
removedSessionIds?: ReadonlySet<string>
- showAllSessions: boolean
}) {
const { t } = useI18n()
const s = t.sidebar
@@ -183,7 +177,6 @@ function RepoFlatSection({
onNewSessionSplit={group.isKanban ? undefined : onNewSessionSplit}
onRemove={group.isMain || group.isKanban ? undefined : () => setRemoveTarget(group)}
renderRows={renderRows}
- showAllSessions={showAllSessions}
/>
))}
</>
diff --git a/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx b/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx
index 8968dfb4c13..2d03d01f315 100644
--- a/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx
+++ b/apps/desktop/src/app/chat/sidebar/projects/workspace-group.tsx
@@ -9,7 +9,7 @@ import type { SessionInfo } from '@/hermes'
import { useI18n } from '@/i18n'
import { displayPath } from '@/lib/display-path'
import { useStoreSelector } from '@/lib/use-session-slice'
-import { setWorkspaceNodeOpen } from '@/store/layout'
+import { $sidebarShowAllSessions, setWorkspaceNodeOpen } from '@/store/layout'
import { notifyError } from '@/store/notifications'
import { newSessionInProfile, pinNewChatProfile, selectProfile } from '@/store/profile'
import { switchBranchInRepo } from '@/store/projects'
@@ -37,8 +37,6 @@ interface SidebarWorkspaceGroupProps {
// When set (linked worktree rows), shows a remove affordance that runs a real
// `git worktree remove`.
onRemove?: () => void
- /** Render all loaded workspace sessions instead of the ordinary page. */
- showAllSessions?: boolean
}
export function SidebarWorkspaceGroup({
@@ -46,8 +44,7 @@ export function SidebarWorkspaceGroup({
renderRows,
onNewSession,
onNewSessionSplit,
- onRemove,
- showAllSessions = false
+ onRemove
}: SidebarWorkspaceGroupProps) {
const { t } = useI18n()
const s = t.sidebar
@@ -56,6 +53,10 @@ export function SidebarWorkspaceGroup({
// that leaves this profile's spend unchanged doesn't repaint its header.
const usage = useStoreSelector($sessionProfilesUsage, all => all[group.id])
const rankIds = useStore($sidebarSessionRankIds)
+ // The sidebar's "Show all sessions" preference lifts the lane's page too —
+ // the same switch that widens the project overview, read at the leaf like
+ // overview-row does.
+ const showAllSessions = useStore($sidebarShowAllSessions)
// Empty worktree/branch lanes start collapsed — they only show a "No sessions
// yet" placeholder, so defaulting them open just adds noise. Profile lanes and
// lanes that already hold sessions default open.
@@ -67,11 +68,10 @@ export function SidebarWorkspaceGroup({
// rows it hides are the ones the sort ranked last.
const sessions = rankSessions(group.sessions, rankIds)
// A profile previews the same handful a project does, and clicking its label
- // is how you see the rest. Workspace groups page within what's loaded.
- const visibleSessions = sessions.slice(
- 0,
- isProfileGroup ? PROJECT_PREVIEW_COUNT : showAllSessions ? undefined : visibleCount
- )
+ // is how you see the rest. Workspace groups page within what's loaded unless
+ // the user asked for everything.
+ const laneCap = showAllSessions ? sessions.length : visibleCount
+ const visibleSessions = sessions.slice(0, isProfileGroup ? PROJECT_PREVIEW_COUNT : laneCap)
const hiddenCount = isProfileGroup ? 0 : sessions.length - visibleSessions.length
const nextCount = Math.min(SIDEBAR_GROUP_PAGE, hiddenCount)
diff --git a/apps/desktop/src/app/chat/sidebar/sessions-section-new-session-drag.test.tsx b/apps/desktop/src/app/chat/sidebar/sessions-section-new-session-drag.test.tsx
index 6ca8e82f992..8dffd94effb 100644
--- a/apps/desktop/src/app/chat/sidebar/sessions-section-new-session-drag.test.tsx
+++ b/apps/desktop/src/app/chat/sidebar/sessions-section-new-session-drag.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
import type { ReactNode } from 'react'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
@@ -189,14 +189,12 @@ describe('Show all sessions', () => {
it('keeps the five-session page by default and renders every loaded workspace session when enabled', () => {
workspaceOpen.value = true
- const { rerender } = render(
- <SidebarWorkspaceGroup group={group({ sessions })} renderRows={renderRows} showAllSessions={false} />
- )
+ render(<SidebarWorkspaceGroup group={group({ sessions })} renderRows={renderRows} />)
expect(screen.getByText('session-5')).toBeTruthy()
expect(screen.queryByText('session-6')).toBeNull()
- rerender(<SidebarWorkspaceGroup group={group({ sessions })} renderRows={renderRows} showAllSessions />)
+ act(() => $sidebarShowAllSessions.set(true))
expect(screen.getByText('session-6')).toBeTruthy()
expect(screen.queryByRole('button', { name: /Show .* more in feature/ })).toBeNull()
diff --git a/apps/desktop/src/app/chat/sidebar/sessions-section.tsx b/apps/desktop/src/app/chat/sidebar/sessions-section.tsx
index 46ce448a79c..b05d9ab3069 100644
--- a/apps/desktop/src/app/chat/sidebar/sessions-section.tsx
+++ b/apps/desktop/src/app/chat/sidebar/sessions-section.tsx
@@ -492,7 +492,6 @@ export function SidebarSessionsSection({
removedSessionIds={removedSessionIds}
renderRows={renderRowsDated}
repoWorktrees={projectRepoWorktrees}
- showAllSessions={showAllSessions}
/>
) : (
emptyState