Skip to content

fix(ios): iPad sidebar tabs no longer stick on the wrong tab - #20144

Open
PixPMusic wants to merge 1 commit into
pingdotgg:mainfrom
PixPMusic:pixpmusic/ipad-sidebar-tabs
Open

PixPMusic wants to merge 1 commit into
pingdotgg:mainfrom
PixPMusic:pixpmusic/ipad-sidebar-tabs

Conversation

@PixPMusic

Copy link
Copy Markdown
Contributor

Problem

On iPad, the Threads / Pull requests picker at the top of the sidebar drifts out of sync. After switching to Pull requests and back to Threads, the thread list shows but "Pull requests" stays highlighted. On the next trip the reverse happens: the list stays on pull requests, and tapping Threads does nothing, because SwiftUI thinks that segment is already selected. It alternates on every round trip, so it looks intermittent.

Cause

WorkspaceNativeTabs retains a separate copy of the workspace tree for each tab, and each copy has its own picker. Tapping a segment moves that SwiftUI picker immediately, then the tab switch freezes the tree it lives in. When that tab comes back, React renders the same selection the frozen copy last had, so nothing reaches the native picker and it keeps showing the segment tapped before. Instrumenting the flow showed the stuck tap never reaches onSelect.

Fix

Key the picker on selectionRevision, which the workspace state already bumps on every tab switch, and which the root header already uses to refresh the retained trees. Whichever copy becomes visible mounts a fresh picker from the current selection. The copy that was tapped is frozen and hidden at that point, so the remount isn't visible.

Why this qualifies as a small focused fix

It's one obvious defect: the sidebar picker shows the wrong tab and ignores taps. The fix is one key in one component and changes no behavior beyond keeping the picker in sync. It affects only the wide iPad layout, where this picker appears.

Verification

  • iOS 26.5 iPad simulator, isolated server with synthetic showcase data.
    • On main, from a fresh launch, a single Pull requests → Threads round trip leaves Pull requests highlighted over the thread list. Opening a thread first and then switching tabs left the app stuck on Pull requests every other cycle.
    • With the fix, 8 of 8 cycles of open a thread → Pull requests → Threads ended on Threads, with delays between taps from 0.3s to 3s. Three plain Pull requests ↔ Threads round trips showed the matching list and highlight each time.
  • vp lint and vp fmt --check on the changed file are clean, and vp run typecheck in apps/mobile passes.
  • No unit test: the defect lives in the native picker's own state across React Native screen freezing, which isn't reachable from the existing JS tests.

Before / After

iPad, after one Pull requests → Threads round trip from a fresh launch.

Before After
Before: the thread list is showing but Pull requests is highlighted in the sidebar picker After: the thread list is showing and Threads is highlighted

#20133 also touches this file (it moves the selection handler into a shared hook) and will need a one-line rebase after either one merges.

Model: Claude Opus 5.5 | Harness: Claude Code in T3 Code

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XS 0-9 changed lines (additions + deletions). labels Oct 16, 2026
@macroscopeapp

macroscopeapp Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at d33882e

Macroscope's review found this PR approvable — This is a four-line, iOS-only fix that remounts the existing sidebar picker on workspace tab switches so its native selection cannot remain stale. The change is isolated to the iPad/sidebar UI and introduces no new capability, schema, default, or static-analysis override.

You can add or adjust custom eligibility rules. Learn more.

@coderabbitai

coderabbitai Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Path: .coderabbit.config.ts
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1da08b89-1770-41a7-8081-e6b174cddb46
📥 Commits

Reviewing files that changed from the base of the PR and between d33882e and 627cdb3.

📒 Files selected for processing: 1
  • apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.

📝 Walkthrough

The iOS workspace sidebar now uses workspace.state.selectionRevision as the SegmentedControl key. The control remounts when that value changes.

Changes: Workspace sidebar picker

Layer / File(s) Summary
Segmented control remount
apps/mobile/src/features/workspace/WorkspaceSidebarTabs.ios.tsx
The SegmentedControl key now uses workspace.state.selectionRevision. A comment describes the iOS picker behavior.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: ⚪ Minimal · up to 627cd

The picker remounts when the selected tab changes while continuing to receive the current selection. No concrete merge-blocking risk is established.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly and concisely describes the iPad sidebar picker fix.
Description check Passed The description explains the problem, cause, fix, focused scope, verification results, limitations, and before/after evidence. It also explains why the change qualifies as a small focused fix without …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the problem, cause, fix, focused scope, verification results, limitations, and before/after evidence. It also explains why the change qualifies as a small focused fix without a linked issue.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Each workspace tab retains its own copy of the sidebar, including the
Threads / Pull requests picker. Tapping a segment moves that SwiftUI
picker before the tab switch freezes its tree. When the tab comes back,
React renders the same selection as before, so the picker keeps the
stale segment. Every other round trip the highlight disagreed with the
list, and tapping the highlighted segment did nothing.

Remount the picker on each tab switch so the visible copy always starts
from the current selection.
@PixPMusic
PixPMusic force-pushed the pixpmusic/ipad-sidebar-tabs branch from d33882e to 627cdb3 Compare October 17, 2026 05:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant