Skip to content

fix(tasks): make Linear list section headers collapsible - #21302

Closed
dev-isaacmello wants to merge 3 commits into
stablyai:mainfrom
dev-isaacmello:fix/linear-task-section-collapse
Closed

dev-isaacmello wants to merge 3 commits into
stablyai:mainfrom
dev-isaacmello:fix/linear-task-section-collapse

Conversation

@dev-isaacmello

@dev-isaacmello dev-isaacmello commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

ELI5

In the Tasks window, when you look at Linear issues grouped by status (or team, assignee, priority), each group sits under a grey header row with a small arrow on it. The arrow made the header look like something you could click to fold the group away — but clicking it did nothing, because that header was only decoration with no handler behind it. Now clicking a header folds that group's issues out of sight, and clicking again brings them back. The arrow points down when the group is open and right when it is folded, which is how the Jira list in the same window already behaves.

What Changed

Before. Tasks → Issues, with Linear as the task source and any "Group by" other than None: each category rendered as a static div carrying a decorative ChevronDown. Clicking the header or the chevron did nothing, on every platform. The header was also not reachable by keyboard.

After. The header is a real button. Clicking it — or tabbing to it and pressing Enter/Space — collapses that category: its issues leave the list and the chevron flips to ChevronRight. Clicking again restores them. The issue count stays on the header, so a folded category still says how much is inside. Collapse is per-category (folding one leaves the others expanded) and it survives loading another page of issues. It belongs to the list in front of you: changing "Group by", or moving to another Linear view (a project's Issues tab, a custom view, back to My Issues), starts fresh — section keys like status:Done repeat across views, so carrying a collapse over would fold a category you never touched there.

Mechanism. Rows for this list are produced flat by useTaskPageLinearListPresentation as [section, ...issues, section, ...issues], so there was nowhere to hang collapsed state and nothing that could hide a row. The hook now owns a Set of collapsed section keys plus a stable toggleLinearSection(key) callback, stamps collapsed onto each section row, and omits a collapsed category's issue rows while building linearIssueListRows. The set carries the scope it belongs to — a string identifying the active Linear context plus the grouping, reusing the precedence the projection already applies in three places (project-issues → custom-view-issue → default list). Reads ignore a set whose scope no longer matches, so a stale fold can never be painted, and an effect then drops it so returning to a list always starts expanded. IssueTable renders the header as a <button> and reads row.collapsed for the chevron and for aria-expanded.

Why

The header already carried a chevron, so it promised a disclosure control that the code never implemented — which is exactly the mismatch the issue reports. The Jira list (task-page-jira-issue-list.tsx) already solves this with per-section collapse state, so this follows its shape rather than inventing a second pattern for the same job in the same window (docs/STYLEGUIDE.md, UX rule 2: adjacent siblings should read as one design).

Alternatives considered:

  • Wrap each section in Radix Collapsible, exactly as the Jira list does. The Jira list renders nested section → issues; the Linear list is deliberately flat — one linearIssueListRows array feeding a single map. Nesting it would have restructured the renderer for no user-visible gain. Filtering the flat row list keeps the change confined to state.
  • Reuse <Button variant="ghost"> like the Jira sibling. The repo's shadcn/no-restyle gate rejects the background, padding, radius and focus classes that this band needs when they appear on new lines, and adding a button variant for a single call site would change a shared primitive. A native <button> keeps the header's exact existing layout classes and adds only the hover and focus-visible treatment already used by the issue rows in the same file.
  • Persist collapse into the per-device view state (orca.linear.issue-view.v1). Out of scope for a bug fix, and the Jira sibling does not persist either — keeping them identical avoids a seam between the two lists.

Linked Issue

Closes #21228

Visual Proof

Captured with the repo's own Electron + Playwright harness against the mocked Linear IPC backend (the same fixture shape tests/e2e/linear-issue-view-persistence.spec.ts installs), so these are the real rendered app, not a mockup. No Linear account was needed. Both columns are the identical scenario: Tasks → Issues, task source Linear, Group by: Status.

The row that matters is the second one — the same click, on the same header.

Before (main) After (this PR)
Grouped list as it opens before, list expanded after, list expanded
After clicking the Todo header before, nothing happens after, Todo collapsed

Before: the click does nothing — all three Todo issues stay, the chevron stays pointing down. After: Todo folds away, the chevron flips to point right, the count 3 stays on the header, and In Progress and Done are untouched.

The capture spec asserted this mechanically rather than by eye — it probed whether the first Todo issue was still visible after the header click:

[shot] before: Todo issue visible after header click = true
[shot] after:  Todo issue visible after header click = false

(The capture spec was a throwaway and is not part of this PR; only the four files in the diff are.)

Testing

Automated. New src/renderer/src/components/use-task-page-linear-list-presentation.test.ts — 10 renderHook cases over the presentation hook:

  • collapsing a section hides exactly that section's issue rows and marks its header row collapsed
  • the collapsed header keeps its label and its issue count
  • toggling the same section again restores the rows
  • collapsing one section leaves the other sections' headers and rows untouched
  • collapse survives a new page of issues arriving (same grouping, different pagedLinearIssues)
  • changing Group by clears collapsed state
  • switching the active Linear view clears it too (My Issues → a project's Issues tab, under the same grouping)
  • a collapse does not carry between two different projects
  • no render after a view switch paints a stale collapse (records linearIssueListRows on every render, not just the settled one)
  • with Group by: None there are no section rows and a toggle is a no-op

These are written to catch a regression, not to cover lines. As a check on that: loosening the reset effect so it also fires on pagination makes the pagination case fail; keying it on linearGroupBy alone (the first version of this PR) fails both view-scoping cases; stamping collapsed: false unconditionally fails the first two; and removing the scope guard on reads fails the stale-frame case.

Manual. Drove the real app through Electron + Playwright (headless, ORCA_BACKGROUND_LAUNCH=1, CDP screenshots of a hidden renderer) with the mocked Linear backend: opened Tasks → Issues → Linear, set Group by: Status, clicked a category header, and confirmed the section folds and unfolds and that the other categories do not move. See Visual Proof for the before/after and the mechanical probe.

Platforms. Verified on Linux (Ubuntu 24.04, Electron headless). Not executed on macOS or Windows: the change is renderer-only React state plus a native <button> with no platform-conditional code, no modifier-key handling and no path handling, so there is nothing that can diverge per OS. Not tested over SSH either — the toggle makes no IPC or host round-trip, so it cannot be affected by remote latency.

Repo checks. pnpm lint ✅ · pnpm typecheck ✅ · pnpm build ✅ · pnpm run check:code-quality:changed ✅ (design-system and casting gates clean on the changed lines).

pnpm test: 8871 files passed, 11 failed. Those 11 are not from this change — I re-ran exactly those files against a clean tree at the same base commit (09622f0c28) and 10 of them fail identically there (they need a real Claude CLI binary, a specific bash, FTS5, or a relay host). The 11th, palette-match-performance.test.ts, is a wall-clock budget test that fails only under full-suite load and passes on its own with this change applied. The new tests and every other renderer/component test pass.

  • I manually tested these changes locally
  • Automated tests added/updated, or explained why not below

AI Disclosure

Claude Opus 5, via Claude Code.

Review

Code review summary from the agent that wrote the change:

  • Cross-platform (macOS / Linux / Windows). No platform-specific risk. The change is renderer-only React state plus a native <button>; it reads no modifier key, builds no path, and calls no platform API. Nothing here renders or behaves differently per OS.
  • Remote / SSH / local. No IPC, no main-process call, no new data fetch. The toggle is local renderer state, so it responds at local speed even when the execution host is remote. Collapse is intentionally not persisted, so there is no new wire field and no mixed-version client/host concern.
  • Folder workspaces vs git worktrees. Not applicable — the tasks list does not read workspace shape.
  • Agent and integration compatibility. Scoped to the Linear task source. The Jira, GitHub and in-Orca lists are untouched. The Linear board is unaffected: use-task-page-linear-board.ts builds its own sections from groupLinearIssues and never reads linearIssueListRows, which has exactly two consumers — the hook that produces it and IssueTable.
  • Git provider compatibility. Not applicable — no source-control or review surface is touched.
  • Review follow-up. The first commit reset collapse only on a Group by change. A review caught two things and both were right: the code comment's stated reason was false (getLinearIssueGroup namespaces keys per grouping, so a stale key can never match another grouping's section), and collapse leaked across Linear views that share a grouping. ad00b08 fixes the comment and scopes the reset to the active view. A second review then caught that an effect-only reset still lets the first render of a new view use the old set, so a section could flash collapsed in a list it was never collapsed in; 88d060e makes reads scope-aware so that window does not exist.
  • Performance. One Set.has per section (not per row) inside the existing useMemo. The memo gains the collapsed set as a dependency, so it recomputes on toggle — which is the point of the change. A collapsed section skips constructing its issue row objects entirely, so folding a large category makes the render cheaper rather than more expensive. toggleLinearSection is useCallback-stable, and the grouping-change reset returns the same Set when it is already empty, so it does not cause a render on mount.
  • UI quality. The header keeps its existing height, background, gap and typography. It gains hover:bg-accent and the focus-visible ring already used by the issue rows in this same file, so it reads consistently in light and dark mode. Chevron direction follows the Jira convention — down when open, right when collapsed. No new tokens, colors, sizes or shadow tiers. pnpm run check:code-quality:changed (which includes the design-system gate) passes on the changed lines.
  • Accessibility. The header was a non-interactive div; it is now a real button, so it is tab-reachable and Enter/Space activates it, and aria-expanded reports the state to assistive tech.
  • Security. No user input parsed, no network call, no IPC, no dangerouslySetInnerHTML, no new dependency. No security surface.

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

  • Security: no new surface — see the Review section.
  • Cross-platform (Linux / Windows / macOS): renderer-only; nothing platform-dependent was added.
  • Remote SSH: no IPC or host round-trip; the toggle stays local and stays responsive under latency.
  • Mobile: mobile/ is untouched; this component does not ship there.
  • Backwards compatibility: collapsed is a new field on an internal renderer row type with two in-repo consumers, both updated here. Nothing persisted, nothing on the wire, no settings migration.
  • Performance: one extra Set lookup per section per recompute; collapsed sections skip row construction.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

Author

X (Twitter) handle: N/A — contributor prefers not to share one.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: e7ca76d9-ef3f-4d76-b07d-13b962cb4d01

📥 Commits

Reviewing files that changed from the base of the PR and between ad00b08 and 88d060e.

📒 Files selected for processing (2)
  • src/renderer/src/components/use-task-page-linear-list-presentation.test.ts
  • src/renderer/src/components/use-task-page-linear-list-presentation.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/renderer/src/components/use-task-page-linear-list-presentation.ts
  • src/renderer/src/components/use-task-page-linear-list-presentation.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The Linear issue row model now carries section collapse state. The presentation hook tracks collapsed section keys by scope, resets stale state when the scope changes, and omits issue rows for collapsed sections. IssueTable renders accessible toggle buttons with directional chevrons. Tests cover toggling, grouping changes, pagination, active view and project changes, first-render reset behavior, independent sections, and ungrouped lists.

Priority: ➖ Normal

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 88d06

The section-collapse behavior has no concrete remaining merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #21228 requires Linear task category headers or disclosure controls to toggle. IssueTable now uses accessible buttons with click and keyboard activation, aria-expanded, and direction-specifi…
Out of Scope Changes check ✅ Passed The changes update the Linear row model, section-header UI, collapse-state handling, and related automated tests. Each change supports the collapse and expansion behavior in issue #21228. No unrelated…
Title check ✅ Passed The title clearly and concisely describes the main change: making Linear list section headers collapsible.
Description check ✅ Passed The description covers the required sections, explains the user-visible behavior and implementation, links issue #21228, includes visual proof, testing details, AI disclosure, review notes, compatibil…
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — one rough edge worth a look.

Reviewed changes

  • Collapsible Linear section headers. LinearIssueListRow's section variant gains collapsed; the presentation hook owns a Set of collapsed keys plus a stable toggleLinearSection, and omits a collapsed section's issue rows from linearIssueListRows.
  • Header becomes a real control. IssueTable renders the header as a native <button type="button"> with aria-expanded, a ChevronRight/ChevronDown swap, and the same hover and focus-visible treatment as the issue rows in the same file.
  • Tests. Seven renderHook cases cover toggle, per-section isolation, header count retention, pagination survival, grouping-change reset, and Group by: None. I ran the file — 7 passed — and pnpm run check:code-quality:changed against the PR base reports 0 findings across the 4 changed files.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@dev-isaacmello

Copy link
Copy Markdown
Contributor Author

Pushed ad00b08 addressing the review — details in the thread. Short version: the reset is now scoped to the active Linear view, not just the grouping, so a collapse no longer carries from My Issues into a project's Issues tab that shares the same Group by. Two tests pin it.

On the one failing pre-merge check — Docstring Coverage 0.00% — I've deliberately not chased it, and wanted to flag that rather than leave it looking unnoticed. It reads as a generic threshold that points the opposite way from this repo's own convention:

  • AGENTS.md → "Concise/Brief Non-obvious Comments ONLY — DO NOT: be verbose, explain the obvious, walk through the code. BE CONCISE. 1 LINE if possible."
  • 0 of 48 src/renderer/src/components/use-task-page-*.ts hooks carry a /** */ block.
  • The sibling this PR mirrors, task-page-jira-issue-list.tsx, has none either.

Adding docstrings to these four files to reach 80% would make them the only ones in the family with them. The two non-obvious decisions in the diff are commented inline, one line each, which is what the guide asks for. Happy to add them if a maintainer would rather have the check green.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: 9b72959a-5c91-4796-9edf-f02615955a33

📥 Commits

Reviewing files that changed from the base of the PR and between d2fe81c and ad00b08.

📒 Files selected for processing (2)
  • src/renderer/src/components/use-task-page-linear-list-presentation.test.ts
  • src/renderer/src/components/use-task-page-linear-list-presentation.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Collapse reset scoped to the active Linear view. The reset effect no longer keys on linearGroupBy alone: a new linearSectionScopeKey memo encodes the active context (project:<id> when the project Issues tab is active, view:<id> for issue-model custom views, else list:<linearMode>) plus the grouping, mirroring the precedence already used by the projection and selection hooks. A section collapsed in My Issues no longer renders collapsed in a project's Issues tab that shares the grouping.
  • Reset-effect comment corrected. The old rationale ("a stale collapse would hide an unrelated section") was untrue — getLinearIssueGroup namespaces keys per grouping — and now states what the reset actually protects against: keys repeat across views and groupings.
  • Tests expanded to 9 cases. Two new renderHook cases cover a list→project switch under the same grouping and project A→project B; both fail if the effect is keyed on linearGroupBy alone, so the regression is pinned. Existing cases were updated to thread the active view through the harness.

I re-ran the new test file (9 passed) and pnpm run check:code-quality:changed (0 findings across the 4 changed files).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

  • Scope-aware collapse reads. collapsedLinearSectionKeys now compares the stored scopeKey against the current linearSectionScopeKey and falls back to an empty set, so the first render after a view switch cannot paint the previous list's collapse. The effect then normalizes the stored state, so returning to a list always starts expanded.
  • toggleLinearSection rebuilds from the scoped set. The updater carries current.keys forward only when the scope matches, so a toggle landing before the reset effect runs starts from empty rather than from a stale set. The callback is recreated per scope, which is what makes the closure's linearSectionScopeKey authoritative.
  • Regression test added. A new case records linearIssueListRows on every render and asserts no post-switch render hides rows; it fails if the scope guard is removed. The file is at 10 cases, all passing.

I re-ran the test file (10 passed) and pnpm run check:code-quality:changed (0 findings across the 4 changed files).

Pullfrog  | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@nwparker

nwparker commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Closing as superseded — the linked issue (#21228) has been resolved on main by #34173 (41755b5b24). Thanks for the contribution!

@nwparker nwparker closed this Nov 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Tasks category does not collapse or expand

2 participants