Repository navigation
fix(mobile): fold and open the composer without moving the timeline - #367
Merged
Merged
Conversation
Keep the measured expanded input reserve through fold transitions, anchor the newest turn correctly, and reveal controls only after their row has room. Consume scroll intent after each transition and ignore keyboard, layout, anchor and programmatic corrections until a fresh reader gesture. Fixes: #359 Related: #308 Related: #352
nixuuu
added a commit
that referenced
this pull request
Nov 8, 2026
Opening a mobile thread could show `opus`, add the effort and permission controls, then move the last answer while the push was still running. Initialize the composer at its expanded size, preload cached history before list navigation, and keep model/effort slots and the ended-turn footer stable as their values arrive. Fixes: #292 Related: #367 Related: #359 ### Causes and changes 1. **Composer rows and timeline reserve started at zero.** `ComposerFold` measured an absolutely positioned child after mount; until that callback, its clip had height 0. `useFloatingComposer` also initialized the inverted-list reserve to 0. This path was introduced with the floating composer in #292 and remained through #367. Both control rows now start at their expanded heights, and thread screens reserve **186 dp** immediately: input 64 + toolbar 56 + secondary row 36 + gap 8 + padding 20 + borders 2. The toolbar's attach button is 36 dp plus 20 dp padding, so its actual expanded height is 56, despite the old 52 dp minimum. Native measurements still handle real content changes. #367's retained expanded reserve, gesture rules and partial-opening guard remain intact; keyboard motion, safe areas, accessories and the **32 dp fade** remain separate. 2. **Catalog values existed only after a component-local request.** `useModelCatalog` started empty on every mount, `MessageComposer` fell back to `thread.model`, and effort existed only after finding the model's supported efforts. Catalogs now belong to the current paired client, preload from the overview's available workers, share in-flight requests and supply a synchronous external-store snapshot. Model, effort and permission slots retain widths of **160/96/128 dp**. An unavailable catalog shows same-size skeletons; a model without effort leaves its slot empty. The raw thread model id is never the temporary label. The permission pill was already unconditional; allocating its secondary fold's height makes it present from the first frame. 3. **Missing timestamps removed the footer line.** `TurnDetails` returned `null` until both timestamps existed. An authoritative turn update could insert that line underneath an already visible answer. Ended turns now retain the line height while awaiting a duration, matching web's permanent `TurnDetails` row. Existing snapshot encoding already preserves turn timestamps; no protocol or cache-format change is needed. 4. **Disk cache loaded after navigation.** `useThreadSnapshot` can initialize synchronously only from `peek`; a disk-only entry previously arrived from an effect after the push began. Thread-list rows, including side/archived rows, now load that local entry before push/replace. They never wait for network data. Later navigation, another tap or a pairing change invalidates a pending open. Cache misses retain the existing timeline skeleton. `Syncing…` is already an accessory outside the measured composer and list header; its appearance/disappearance changes neither the reserve nor composer position, so it stays there. The supplied recording's frames 37–40 support the label/row/footer sequence. They do not isolate how much of the large jump comes from the footer versus the reserve. No recording, frames, logs or machine-specific paths are included in this change. ### Verification - Passed: `bun install`, `bun run gen:check`, `bun run typecheck`, `bun run lint`, `bun run format:check`, and `bun run --filter @canopy/web build`. Ran `bun run format`. ESLint for every changed mobile file is also clean. No UI tests added. - Final full foreground `bun run check:tmp`: **1,842 passed, 161 skipped, 0 failed**, 327 files, exit 0; **nothing left in the test-owned temp directory**. Opt-in live tests were skipped. Earlier full runs each had 1,841 passed, 161 skipped and one failure: unchanged `linked-list-retention.test.ts:118` (`awayReason(...)` was undefined), then unchanged `config-sync-projects.test.ts:308` (`response.attached` was false). Other agents were running full suites on the same machine with shared memory; load-related timing is suspected. Both tests passed in the final full run. No gateway or test workaround is included. - Both files pass **separately on this branch**, each through foreground `check:tmp`: `linked-list-retention` **1/1**, `config-sync-projects` **11/11**, both with clean temp directories. The maintainer independently reported the same separate-file results on current **`dev`: 1/1 and 11/11**. CI remains the gate; the final full run passed without needing the maintainer's exception for these two load-sensitive failures. - Additional whole-app Expo lint exposes existing errors in unchanged `state/gateway-departure.ts` (`react-hooks/purity`, `react-hooks/set-state-in-effect`) and an existing `react-hooks/exhaustive-deps` warning in `features/updates/state.tsx`. The required root lint and changed-file ESLint pass. - Device verification is **not performed**: installed simulator clients lack native modules required by the checkout. No native/EAS builds, OTA publication or server startup attempted. Root-cause review includes the supplied iPhone frames and the shared iOS/Android implementation; the precise manual checks below remain to be run on compatible clients. **OTA compatibility:** JS/TS and documentation only; no dependencies, native modules or runtime configuration changed. Before and after, from `apps/mobile`, ran `bunx [email protected] fingerprint:generate --platform <ios|android> --build-profile production --json --non-interactive` for both platforms: | Platform | Before | After | | --- | --- | --- | | iOS | `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3` | `2a0ef03a2a0fda8e7fad2e3df8609803d2edbda3` | | Android | `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d` | `c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07d` | ### Manual checks on compatible iOS and Android clients 1. Open a completed thread with model alias `opus` from the list. Record the push: the model display name (or reserved skeleton), effort and permission row must already occupy their final slots; composer height and the last answer must remain fixed. Return and reopen, then repeat after restarting the app so the history is disk-only. Repeat offline with cached history, and with a cache miss online. Rapidly tap different threads or navigate elsewhere during a disk read; no delayed extra push should occur. 2. Test native and custom provider profiles, explicit/default effort, models without effort, and unknown models/catalog failures. Use short, typical and long model/worker names at narrow phone and tablet widths. Labels must truncate within their slots and remain accessible; horizontal toolbar scrolling and model/effort/permission pickers must work without moving adjacent controls. 3. Open an ended turn with cached timestamps, then older cached data without timestamps and let it synchronize. A duration must fill its reserved line without moving the answer. Change between connecting, syncing, live and reconnecting; `Syncing…` must not change the list reserve or composer position. Check that the fade remains 32 dp. 4. Repeat #367's folding checks: drag at least 96 dp toward history past 192 dp from the end, then return within 8 dp or tap “Show latest”. No completion jump, clipped controls or programmatic-scroll fold should occur. Test typing, multiline drafts, clearing/sending, attachments, synchronous questions, keyboard open/hide/interactive dismissal, and shared bot-composer folding. 5. Repeat in light/dark, reduced motion, portrait/landscape and larger system text. Confirm the writing handoff retains its height and the last message stays above the composer. Initial size at non-default accessibility font scales still requires device confirmation because native text measurement can exceed the baseline geometry. Copy audit (§8): temporary raw model id → catalog display name or same-size skeleton; no new UI strings. Existing “Model”, effort and permission labels retain their copy. Single-line truncation and full accessibility labels are preserved in code; device/width checks are explicitly pending above.
This was referenced Nov 13, 2026
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.
Folding the mobile composer changed the inverted timeline's header after the animation, moving messages independently of the reader's finger. Returning to the end revealed partly clipped controls and then moved the last message again when the reserve caught up.
The composer now retains its measured expanded input reserve through both directions. Folding and opening animate only the overlay; the last message already has room throughout opening. Controls get their full row height before fading in and disappear before that height closes. Motion keeps the existing
medium/slowtokens,smoothOut, and instant reduced-motion path. Writing still transfers the secondary row's height to the field; attach/model/effort remain available.Fixes: #359
Related: #308
Related: #352
Root causes
animateto callsettlein both directions and allowed folded measurements to updateheight. During a fold,progressmoves from 1 to 0 andmeasured.currentbecomes the pill height, while the list still reserves the expanded height. The completion callback then clearsmovingand schedulessettleon JS, which assigns the smaller height to the list header andChatKeyboardoffset. Native anchoring/scroll clamping happens in a later layout, outside the finger movement. Opening does the reverse: the overlay grows over the smaller reserve, then the header grows at completion. The new fold completion never assigns reserve height; delayed partial opening measurements cannot shrink the retained reserve. Safe area, keyboard, empty status slots and suggestions remain excluded. The deliberate tradeoff is that a folded input retains only its actual expanded input space until it reopens; this does not restore the former empty status/fade reserve.minIndexForVisible: 1was intended to skip the reserve, but RN 0.88.1VirtualizedListalready adds one forListHeaderComponent. The resulting native index was 2, skipping the newest turn and potentially anchoring a later/offscreen turn while reading a long newest turn. Keep the following-list index at 0 so the native index becomes 1. fix(mobile): clean settings transitions and back navigation #358 changed routing/settings, not this geometry. The supplied recording shows the large discontinuity; its exact near-screen magnitude was not instrumented on a compatible client.ComposerFoldused the same progress forheight = naturalHeight * progressandopacity = progress. At progress 0.5, a 52 dp toolbar had a 26 dp clip and was already half opaque, while the field and send button were moving. Keep the measured row mounted at its natural size, finish allocating its height over the first 80% of progress, then fade controls over the remaining progress. In reverse, the controls disappear before the clip shrinks. The writing height transfer remains linear.fromEnd <= 8ran before checkingreader;onMomentumBeginunconditionally enabled reader intent, and travel survived drag boundaries. Thus reserve/anchor scroll events could open the composer and feed offset changes back into fold travel. The suspected loop is supported by the code; a device trace of the recording's individual offsets is unavailable. Keep the 8/192/96 dp hysteresis, reset travel on each drag, consume intent after one transition, and never create intent from momentum alone. Content/viewport/inset changes, keyboard motion, reserve measurements and explicit anchor/programmatic scroll revisions cancel intent until a fresh drag. “Show latest” explicitly expands before scrolling in both thread and bot chat.Verification
bun install,bun run gen:check,bun run typecheck,bun run lint,bun run format:check,bunx expo lintinapps/mobile, andbun run --filter @canopy/web build. Ranbun run formatand the approved spacing autofix. No UI tests added, per repository policy.bun run check:tmp: 1817 passed, 161 skipped, 0 failed, 324 files; exited 0 and reported no test-owned temporary files left. Opt-in live tests were skipped.The package 'react-native-keyboard-controller' doesn't seem to be linked; the installed iOS client failed withCannot find native module 'ExpoUpdates'. Neither can run the current checkout. Used an isolated Metro port and stopped it; no native/EAS build, APK, OTA publication or dependency change was made. No incompatible-client workaround is included. Physical-device parity, light/dark transitions, reduced-motion behavior and frame-by-frame motion remain to be checked on a compatible runtime.OTA fingerprints
Generated before and after using EAS CLI 27.4.1, profile production, for each platform:
2a0ef03a2a0fda8e7fad2e3df8609803d2edbda32a0ef03a2a0fda8e7fad2e3df8609803d2edbda3c5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07dc5c880ae8d0f5d7bc867fcbaf8f756b2ca56a07dManual device checks
Copy audit: no UI text changed.