Skip to content

fix: download-speed 0 render crash + restore Add Server on NoModelScreen#25

Merged
fl4p merged 1 commit into
mainfrom
fix/download-speed-crash-and-add-server
Jul 4, 2026
Merged

fix: download-speed 0 render crash + restore Add Server on NoModelScreen#25
fl4p merged 1 commit into
mainfrom
fix/download-speed-crash-and-add-server

Conversation

@fl4p

@fl4p fl4p commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Two defects found in the post-merge adversarial review of code already on main.

🔴 Critical — app crash on download progress

DownloadManagerScreen/items.tsx gated the speed label with item.downloadSpeed && item.downloadSpeed > 0 && item.status === 'running' && (…). computeDownloadSpeed returns 0 on the first progress tick of every download, so the && chain evaluates to the number 0, which React renders as a bare text node outside a <Text>"Text strings must be rendered within a <Text> component" — a hard crash whenever the Download Manager is open during an active download. RNTL's react-test-renderer doesn't enforce this invariant, so the existing test (which only used a positive speed) never caught it. Fixed by coercing the guard to a boolean (!!(…)), so the row is simply hidden at 0 B/s.

🟠 High — "Add Server" no-op on the No-Model screen

A refactor split the chat ModelSelectorModal into two instances and dropped onAddServer from the one embedded in NoModelScreen. Its "Add Server" button therefore just closed the modal instead of navigating to Remote Servers. Re-wired onAddServer={() => navigation.navigate('RemoteServers')}.

Tests

  • New: DownloadManager renders without crashing and hides the speed row when downloadSpeed is 0.
  • Full DownloadManager + ChatScreen suites pass (223); tsc and lint clean.

Related review follow-ups still open (not in this PR): shared main/mmproj EMA speed state (High), stale speed on retry (Medium), restoreConversationModelFn orphaned-selection + hydration-race (Medium). mmproj integrity fixes are in #23.

…odelScreen

Two defects found in post-merge review of code already on main:

1. DownloadManagerScreen/items.tsx guarded the speed label with
   `item.downloadSpeed && … && (…)`. downloadSpeed is 0 on the first progress
   tick of every download, so the && chain evaluates to the number 0 and React
   renders a bare "0" text node outside a <Text> — a hard crash on the real RN
   renderer (RNTL's test renderer doesn't enforce this, so it slipped through).
   Coerce with `!!(…)` so the row is simply hidden at 0 B/s.

2. NoModelScreen's ModelSelectorModal lost the onAddServer prop in a refactor,
   so its "Add Server" button silently just closed the modal instead of opening
   the Remote Servers screen. Wire onAddServer to navigation.navigate('RemoteServers').

Test: DownloadManager renders without crashing and hides the speed row when
downloadSpeed is 0.
@fl4p
fl4p merged commit 5208221 into main Jul 4, 2026
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