Repository navigation
fix(mobile): highlight the workspace this phone last opened on the host, else the desktop's selection - #31081
Merged
Merged
Conversation
…st, never the desktop's selection
…ighlight # Conflicts: # mobile/src/host-screen/host-sidebar-feed-sections.ts # mobile/src/session/use-mobile-session-keyboard-state.test.tsx # mobile/src/session/use-mobile-session-keyboard-state.ts
…d an app list follows a session page's write
…rkspace on the host
…ow is not shown, and keep storage off the e2e list helper's imports
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ELI5
On the phone's list of workspaces for a computer, the highlighted row is now the workspace you last opened on this phone. When that row isn't on screen, it shows the computer's selected workspace instead. That includes when you have never opened one there, so a first visit still shows where the desktop is.
What Changed
Before (with the sidebar switch from #30790 on): the phone always highlighted the desktop's selected workspace. Open
w2on the phone while the desktop hasw10selected, come back, andw10is highlighted.After:
How it works:
orca:last-visited-worktreewhenever the phone shows a workspace. That record now also carries a small per-host map,byHost: { [hostId]: { worktreeId, executionHost? } }, capped at 16 hosts. The top-level fields are unchanged, so home's Resume card and the New Workspace drawer read it as before.executionHostis recorded only for server (runtime:) workspaces, which share ids with the desktop's own rows.activeRowKeys, orworktree.ps'sisActivebefore the feed arrives. ThenhighlightPhoneVisitinmobile/src/worktree/host-list-highlight.tsruns over the rows as shown, after search narrowing. It moves the highlight to the phone's row when that row is shown. That module has no storage or React Native imports, because the e2e phone-list helper builds sections through it.Phone only. Nothing changed in the wire format, the RPCs, the sidebar feed, the shared row builder, or the desktop. The old switch-off path is untouched.
Known limits:
Why
The phone and the desktop are two screens with two people's attention. Showing the desktop's selection over the phone's own choice made the highlight jump for reasons the phone user couldn't see. When the phone has nothing of its own to show, the desktop's selection is the most useful thing to point at.
I reused the existing "last visited" record instead of a new store. Its only writer is already the session screen, which covers every way of opening a workspace. The page is also already allowed to read and write that key. A new key would need the frozen shell to allow it. I didn't use
sidebarInputs.reportView: it reports what is on screen right now to the host, it isn't remembered on the phone, and the phone doesn't send it yet in this stack.Linked Issue
Follow-up to #30790 (base branch
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 isw10. The page gets the route grants the shell sends, so a tap opens the session as a separate page and the list page stays as Back leaves it. "Before" is the page built fromsidebar-flip-a(746e214); "after" is this branch. The desktop build is the same for both.w10w2, session opens on top, Backw2(record from an earlier visit)w10Testing
I manually tested these changes locally (phone page flows above, macOS host)
Automated tests added/updated
use-last-visited-worktree-on-host.test.tsxruns the list and the session as two pages, each with its own module graph and its own load-time copy of storage, the way the shell does. It checks three things:last-visited-worktree-by-host.test.tscovers the per-host record: a host never opened, per-host memory, a record from before this change, the cap, the server/desktop id match, and a refused save.host-sidebar-feed-sections.test.tscovers the rule:use-active-worktree-scroll.test.tsx: the list scrolls to the highlighted row and follows a move, but not a move made during a search, and does not scroll back when the search clears.Local checks, all passing:
pnpm tc;tsc --noEmit, and the mobile test-typecheck ratchet;src/host-screen,src/worktree,src/session,src/mobile-web-shell,src/storage,src/hooks;oxfmt --check(frommobile/);cloud/packages installed).Not verified: the native app on a device or emulator.
Review
Agent skill upstream boundary
Notes
runtime:) rows must also match their server.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)