Skip to content

fix(mobile): archive threads without the list jumping - #770

Merged
nixuuu merged 2 commits into
devfrom
fix/mobile-archive-layout-shift
Nov 15, 2026
Merged

nixuuu merged 2 commits into
devfrom
fix/mobile-archive-layout-shift

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

What jumped (Android recording, nightly)

Frames from the report, at 30 fps:

  1. Swipe snapped back: releasing a committed swipe returned the row to rest, and it sat there for about 0.5 s until the gateway update removed it instantly.
  2. Counter out of step with its rows: the archived rows come from the saved cache, which the stream update changes in the same render. Archived · N and "No archived threads" came from the pager, which refetches after a 100 ms debounce. Archiving showed Archived · 0 over the new row. Unarchiving showed Archived · 1 over "No archived threads.", and then the whole section vanished in one frame.
  3. Rows other than archived ones, the archived heading and the empty state had no exit, so they disappeared abruptly while neighbours moved.

Fix (mobile only)

  • ThreadArchiveSwipe: a committed swipe slides the row off on motion.quick with smoothOut, and the row stays off. With reduced motion it only fades. The gateway update then removes the row, and the cells below glide into place (SidebarOrderCell LinearTransition on fast). A failed request or a confirmation dialog brings the row back. useThreadActions.commit() returns the outcome; run() behaves as before.
  • useArchivedThreads: the count follows the rows it describes (saved?.totalCount ?? page.totalCount). Row and counter now change in the same frame, and the section's visibility uses the same value.
  • SettingsThreadList: every leaving entry fades out (rise.exiting). That covers active rows, the archived heading and status, and the empty state. LayoutAnimationConfig skipExiting stops those exits when the whole list unmounts (Threads/Bots switch).
  • useSettleThread (overview): the archive/unarchive response, and the response to Undo, carries the saved thread. It applies immediately when the stream isn't live, else after 2 s without an echo. It uses the same path as a stream thread event (saved archive cache reconcile + overview upsert), so a swiped row never stays an empty slot. A response whose archive state the list already shows is dropped. A later echo is a no-op: mergeArchivedThread keeps a known row at its index and leaves the count unchanged, and the overview upsert replaces the row in place. The pager refetch that follows returns the same rows.
  • No optimistic list mutation: the server echo is the only move, so there is no double move. The pager's refetch, triggered by the same update, matches the saved rows: same keyset order, and the row already in place keeps its index.

The web sidebar takes rows and count from the same pager state, so it was not affected and is unchanged.

Checks

  • bun install, mobile typecheck, bun run lint, bun run format:check: clean.
  • Native fingerprint (@expo/fingerprint, ios + android) compared against origin/dev: all source hashes are identical. Only TS sources changed; no native modules and no config-plugin changes, so this ships over OTA.
  • Device: not checked. The MacStudio device hub timed out (40 s), and the EAS cloud simulators would need a new build.

Copy audit (docs/copy.md §8)

No UI text added or changed.

Related: #549
Related: #423

A committed swipe carried the row back to rest and left it in place until
the gateway's update, which then removed it at once. The archived counter
came from the pager (debounced refetch) while its rows came from the saved
cache that the same update had already changed, so the section showed
"Archived · 0" over a row or "Archived · 1" over "No archived threads", and
then vanished abruptly.

- A committed swipe slides the row off on `quick` (fades it with reduced
  motion) and keeps it there; a failure or confirmation brings it back.
- The archived count follows the saved rows it describes.
- Every leaving entry fades while the cells below glide (layout tokens);
  switching to Bots skips those exits.

Related: #549
Related: #423
The archive and unarchive responses carry the saved thread. When the
overview stream is not live the response applies at once; otherwise it
waits 2 s for the echo. It goes through the same path as a stream event
(saved archive cache + overview list), so a later echo finds the row in
place and moves nothing. A response whose archive state the list already
shows is dropped.

Related: #549
@nixuuu
nixuuu merged commit f5a320e into dev Nov 15, 2026
12 checks passed
@nixuuu
nixuuu deleted the fix/mobile-archive-layout-shift branch November 15, 2026 00:20
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