Skip to content

Feature request: closing the last tab should return to Home (heatmap), not an empty 'New Session' pane #38

Description

@Broccolito

Please explain the motivation behind the feature request.

When the user closes the last tab, the app currently stays on the tabbed session surface and shows an empty "New Session" pane with no tabs. That's a dead-end state: there are no tabs, but the tab/session UI is still on screen. It would be more intuitive to fall back to the Home page (the one with the usage heatmap and recent chats) whenever there are no tabs — and only show the tabbed "new session" surface again once a tab actually exists (the user types/submits on Home, or opens a new tab).

In short: no tabs → show Home; ≥1 tab → show the tabbed session view. The empty "New Session" pane should never be the resting state.

Describe the solution you'd like

Route back to Home when the last tab is closed, instead of rendering the empty session pane.

Current behavior (traced in code):

  • The app has two surfaces (react-router in ui/desktop/src/App.tsx): /Hub (the Home page: ChatInput + SessionInsights, which renders the usage heatmap and recent chats — components/Hub.tsx, components/sessions/SessionsInsights.tsx) and /pairChatGroupsShell (the tabbed session view).
  • Closing the last tab is handled in components/chatGroups/chatGroupsReducer.tscloseTab (~L390–414). It deliberately leaves an empty group (activeTabId: null, tabs: []) and, per its own comment (~L404–406), "renders BaseChat's existing empty state. It does NOT navigate away."
  • components/chatGroups/ChatGroupsShell.tsx then renders BaseChat with tabKey = activeTab?.tabId ?? \${groupId}-empty`(~L318) — i.e. the empty "New Session" state on/pair`.

Desired behavior:

  • When closing the last tab results in zero tabs across the whole layout (not just an empty half of a split — an empty half already collapses out of the tree via collapseEmptyGroup), navigate back to / (Hub) so the user lands on the Home page with the heatmap.
  • The tabbed /pair surface only shows when there is at least one tab.
  • Creating/typing a new session brings the tabbed view back: submitting on Home already does createSession(...) + setView('pair', …) (Hub.tsx ~L54–59), and Cmd+T / the strip + open a new tab (newTabRegistry) — both produce a tab and return to /pair.

Implementation notes

  • The cleanest hook is in ChatGroupsShell (or an effect on the groups state): when the whole layout has no tabs, navigate('/') instead of rendering the empty BaseChat. This is a deliberate change to the current "does NOT navigate away" design at chatGroupsReducer.ts:404–406, so it's a behavior change (feature), not a bug fix.
  • Preserve the existing good properties: closing a tab must still not delete the session (it doesn't today), and the split case must keep collapsing empty panes rather than navigating home prematurely — only go Home when the entire layout is empty.
  • Also cover arriving at /pair with zero tabs via a stale deep link (redirect to Home).

Describe alternatives you've considered

  • Keep the empty "New Session" pane (today's behavior) — but it's a confusing dead-end with the tab UI visible and no tabs.
  • Auto-open a fresh blank tab on last-close instead of going Home — but that never lets the user get back to the heatmap/overview, which is the point of this request.

Additional context

  • Home surface: components/Hub.tsx (renders ChatInput + SessionInsights); heatmap in components/sessions/UsageHeatmap.tsx via SessionsInsights.

  • Tab lifecycle: components/chatGroups/chatGroupsReducer.ts (closeTab ~L390–414), components/chatGroups/ChatGroupsShell.tsx (~L318 empty-tab render).

  • Routing: ui/desktop/src/App.tsx (/ → Hub, /pair → ChatGroupsShell).

  • I have verified this does not duplicate an existing feature request

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions