Skip to content

[bug]: Right sidebar re-expands on every task switch, ignoring user dismissal #1700

@homebysix

Description

@homebysix

Bug Description

When the "Auto right sidebar" setting is enabled (the default), manually collapsing the right sidebar is not respected when switching between tasks. Every task navigation forces the sidebar back open, making it impossible to keep it dismissed while browsing tasks.

Steps to Reproduce

  1. Open a project with at least two tasks/sessions
  2. Click on Task A — right sidebar expands (expected on first open)
  3. Collapse/dismiss the right sidebar manually
  4. Click on Task B
  5. Observe: the right sidebar re-expands, ignoring the manual dismissal

Actual vs Expected Behavior

Actual: The right sidebar unconditionally expands every time activeTask changes to a non-null value. The useEffect in usePanelLayout.ts (line ~272) calls setCollapsed(false) whenever activeTask !== null, with no check for whether the user manually collapsed it.

Expected: If the user manually collapsed the right sidebar, switching tasks should respect that choice. The auto-expand should only apply when transitioning from a non-task view (home, settings) to a task view — not on every task-to-task navigation.

Additionally, the collapsed state is only held in React useState (in right-sidebar.tsx) with no persistence to localStorage, so it is also lost on page reload.

Additional Context

The root cause is in src/renderer/hooks/usePanelLayout.ts, lines ~261-284. The effect watches activeTask and unconditionally expands the sidebar when it's non-null:

} else if (activeTask !== null) {
  rightSidebarSetCollapsedRef.current?.(false); // always forces open
}

A fix would need to:

  1. Track whether the user manually collapsed the sidebar (e.g., a userDismissed ref)
  2. Skip auto-expand when the user explicitly dismissed the sidebar
  3. Optionally persist the collapsed state to localStorage alongside the existing panel size persistence in persisted-layout.ts

Related: #407 (feature request for auto-open on file changes — same mechanism, opposite direction)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions