Skip to content

perf(mobile): keep feed rows and drafts stable while a bot streams - #300

Open
leoisadev1 wants to merge 2 commits into
perf/web-renderfrom
perf/mobile-streaming
Open

leoisadev1 wants to merge 2 commits into
perf/web-renderfrom
perf/mobile-streaming

Conversation

@leoisadev1

@leoisadev1 leoisadev1 commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Stacked on perf/web-render.

While a bot streamed, every delta rebuilt the whole mobile thread feed: all activities re-sorted with per-comparison Date allocations, every message rewrapped in a fresh object, and every visible row re-rendered, including markdown re-parses on Android. Every keystroke re-rendered the entire thread route because the composer subscribed to the whole drafts map and an unmemoized presentation object defeated the feed's memo. Context-window activity updates, which providers stream continuously, took a full filter, sort, and re-index path in the shared reducer.

Stream chunks now publish one store update per chunk in the shared runtime. Feed builds parse timestamps once and cache rows so unchanged entries keep their identity, and the list gets a stable render context plus an items-equal comparison so it redraws only rows whose content changed. Composer drafts moved to per-thread atoms with a self-contained draft composer, presentation objects are stable, and the native header options are memoized. The reducer handles context-window supersedes on the fast in-order append path, and Home rows re-render per minute only when their time label text actually changes.

Verified with 238 mobile and 69 client-runtime tests passing, including a new burst test that fails on the old per-delta publish behavior, plus clean typechecks and lint. The reconnect full-shell refetch was intentionally left alone: the snapshot carries per-connection data that event replay cannot rebuild. Not verified on a device or simulator; the render changes are covered by unit tests and reasoning only.

Created with Claude Fable 5.1 in Claude Code.

🤖 Generated with Claude Code


Devin Review

@vercel

vercel Bot commented Sep 26, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
akeru-bot-landing Building Building Preview Sep 26, 2026 5:51pm UTC

Request Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL labels Sep 26, 2026
devin-ai-integration[bot]

This comment was marked as resolved.

@greptile-apps

greptile-apps Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Medium risk] Optimizes feed rendering during streaming and typing.

No outstanding findings block merging.

Summary

This PR reduces mobile chat re-renders during streaming by batching thread updates, stabilizing feed rows and drafts, and refreshing time labels only when their text changes. No new findings remain.

Reviews (4) · Last reviewed commit: "fix(mobile): rescan replaced authorizati..."

Comment thread apps/mobile/src/state/use-thread-composer-state.ts
@greptile-apps

This comment has been minimized.

leoisadev1 and others added 2 commits September 26, 2026 15:18
Stream chunks publish one store update each, feed entries stay
referentially stable so the list redraws only changed rows, composer
drafts use per-thread atoms so keystrokes stop re-rendering the route,
and context-window supersedes take the fast reducer path.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
unchangedPrefixLength compared only the endpoints, so replacing an
interior activity by id reported the full previous length and the
authorization scan skipped the replacement. Walk the identity prefix
instead and rescan from the first changed item.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

This branch had an error being deployed

1 failed deployment
Preview — 8b9533fb Deployed Sep 26, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 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