Skip to content

fix(mobile): drop a desktop's conversations while it is not connected - #1343

Merged
huichen merged 2 commits into
mainfrom
pr/huichen
Oct 24, 2026
Merged

huichen merged 2 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

What and why

The sessions list on the phone kept showing a paired desktop's conversations after that desktop went offline, so tapping one opened a session that could no longer be reached. This PR drops a desktop's conversations from the merged list while that desktop is not connected, and restores them when it comes back.

Behaviour notes:

  • Conversations are filtered at the merge step, so a desktop that reconnects shows its rows again without another sync.
  • The screenshot mock follows the same shape so the scenario keeps rendering what the app renders.

Commits

  • fix(mobile): drop a desktop's conversations while it is not connected

Verification

Run locally on the branch tip (788d135eb), Node 22 (the CI line):

  • npx tsc --noEmit (in mobile/) — clean
  • npx eslint on the 7 touched paths — clean
  • npx jest --runInBand src/remote/__tests__/RemoteContext.test.ts src/remote/__tests__/mergeSessions.test.ts src/remote/__tests__/useSessionCatalog.test.ts src/screens/__tests__/SessionsScreen.test.ts — 4 suites, 213 tests passed

The merged list drew every paired desktop's catalogue, and a catalogue
outlives the connection that delivered it: a desktop that was connecting, was
warming its agent up, or was gone still put its last rows in the list — under
a header that already described that machine as unreachable, with rows this
phone could not open until it answered again.

`CatalogEntry` now carries the machine's `MachineStatus`, the same judgement
the picker's row and the badge make, and `mergeSessions` draws rows only from
a `connected` machine. The other three states keep their catalogue (so the
rows come back with the connection) and contribute nothing, including when the
picker names that machine: the screen's own "unreachable" state is the answer
there, as it already was for a machine with no cached rows. `machines` still
lists every paired desktop, so the picker and the badge keep reporting a
machine that is down.

Evidence: `mergeSessions` case spanning all four statuses in one list; provider
case asserting both catalogues' statuses and the rows across a dropped
handshake; screen case asserting a connecting peer draws no merged rows. All
149 mobile suites / 2861 tests green, `tsc --noEmit` and `eslint .` clean
(Node 22, as CI uses Node 24).
@huichen
huichen enabled auto-merge (squash) October 24, 2026 18:17
@huichen
huichen merged commit 75a3caf into main Oct 24, 2026
10 checks passed
@huichen
huichen deleted the pr/huichen branch October 24, 2026 18:34
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