Skip to content

fix(mobile): the phone highlights only the workspace it last opened, and folding never scrolls the list - #31296

Merged
Jinwoo-H merged 1 commit into
sidebar-flip-afrom
phone-highlight-own-only
Oct 21, 2026
Merged

Jinwoo-H merged 1 commit into
sidebar-flip-afrom
phone-highlight-own-only

Conversation

@Jinwoo-H

@Jinwoo-H Jinwoo-H commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 5 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​99 $\color{#cf222e}{\Huge{\mathbf{−}}}$​78 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​21
Prod 6 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​52 $\color{#cf222e}{\Huge{\mathbf{−}}}$​70 $\color{#cf222e}{\Huge{\mathbf{−}}}$​18

ELI5

On the phone's workspace list, the only highlighted row is now the workspace you last opened on this phone, and only while that row is on screen. The phone never highlights the computer's selected workspace in its place. Folding or unfolding a section no longer scrolls the list.

What Changed

Before: if the phone's own row wasn't on screen, the phone highlighted the desktop's selected workspace instead. That covered a phone that had never opened anything there, and a row that was folded, filtered, searched away or deleted. Folding a project that held the phone's row therefore moved the highlight to the desktop's row, and the list scrolled to it.

After:

  • The rule: the phone highlights only the workspace it last opened on that host, and only when that row is shown.
  • Never opened, row not shown, or still loading: nothing is highlighted. "Not shown" covers folded, filtered, hidden as sleeping, searched away and deleted.
  • Scrolling: the list scrolls to the highlighted row only when the highlight moves to a different workspace, for example after you open one. A row that a fold or search hides and then shows again is the same workspace, so it causes no scroll. Neither does a highlight that an unfold reveals for the first time.

How:

  • Highlight: the list builders (buildHostFeedSections, buildPreFeedSections) set each row's highlight from isLastVisitedWorktreeRow alone. The desktop's activeRowKeys, and worktree.ps's isActive mark, no longer feed the phone's highlight. The fallback code (highlightPhoneVisit and the loading-versus-never-opened state) is removed.
  • Scroll: useActiveWorktreeScroll remembers the last workspace it saw highlighted, whether or not it scrolled to it. It scrolls only when a different one appears, and skips a highlight that first appears in the same render as a fold change. It takes the list's folded sections for this, in place of the search flag from fix(mobile): highlight the workspace this phone last opened on the host, else the desktop's selection #31081.
  • e2e: the phone-list helper takes the phone's last-opened workspace. The desktop-parity specs compare rows without the highlight marks, and assert the phone's own highlight by giving it the desktop's open workspace as its visit.

Phone only. Nothing changed in the wire format, the RPCs, the feed, the shared builder, or the desktop.

Why

With a desktop fallback, the phone's highlight jumped to rows the phone user never chose, and the scroll followed it. The owner chose the simplest rule: the phone owns its highlight completely, and shows nothing when it has nothing of its own to show.

Linked Issue

Follow-up to #31081 (already in sidebar-flip-a).

Visual Proof

The real phone page bundle, at a 393x852 viewport, talking to a hidden Orca desktop (ORCA_BACKGROUND_LAUNCH=1) whose selected workspace is w10. The page gets the shell's route grants, so a tap opens the session as a separate page. "Before" is the page built from sidebar-flip-a (a0e6cd8); "after" is this branch.

Scene Before After
Phone never opened anything here
Phone last opened a workspace since deleted
Tap w2, session opens on top, Back (unchanged) (same)

Testing

  • I manually tested these changes locally (phone page flows above, macOS host)

  • Automated tests added/updated

  • host-sidebar-feed-sections.test.ts covers:

    • never opened: nothing highlighted, although the fixture's desktop has a row selected;
    • the opened row is highlighted, and only it (local and SSH rows);
    • a server row with the same id does not count;
    • searched away, then folded: nothing; shown again: the row;
    • deleted: nothing;
    • pinned rows shown twice;
    • pre-feed: never the desktop's worktree.ps mark.
  • use-active-worktree-scroll.test.tsx covers:

    • scrolls on open and when another workspace is highlighted;
    • no scroll when a fold or search hides the row and it comes back;
    • no scroll for a highlight an unfold first reveals, while a later real change still scrolls.
  • tests/e2e/sidebar-phone-feed-list.spec.ts: all 5 tests pass locally (hidden Electron, ORCA_BACKGROUND_LAUNCH=1).

  • Local checks, all passing:

    • mobile tsc --noEmit;
    • mobile vitest for src/host-screen, src/worktree, src/session, src/mobile-web-shell, src/storage, src/hooks;
    • oxfmt --check (from mobile/);
    • every step of the PR workflow's static-analysis job, including the e2e and mobile test-typecheck ratchets.
  • Not run locally: tests/e2e/ssh-orcad-phone-feed-list.spec.ts, which needs the managed Docker SSH host. Its phone visit names the seeded workspace on its managed server (runtime: host), matching how a phone tap routes that row.

Review

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

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)

@Jinwoo-H
Jinwoo-H merged commit 8989273 into sidebar-flip-a Oct 21, 2026
50 checks passed
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.

1 participant