Skip to content

Commit 8172c1f

Browse files
yyq1025claude
andcommitted
chat: drop the 180 composer-inset seed (default 0)
The 180 near-miss seed only existed to force a non-zero post-measure inset delta so initialScrollAtEnd's bootstrap retarget converged within its frame budget — a budget the drawer-close animation used to starve. The drawer-settle gate (transitioningSessionId) now defers the ChatPanel mount until after the close lands, so the hook's default 0 seed converges fine; the real composer height still lands in the mount-time useLayoutEffect before paint. Comments reconciled. (The separate first-open keyboard-lift overshoot is tracked in #22.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent b4e495f commit 8172c1f

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

packages/app/src/components/transcript/chat-panel.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ type ChatPanelProps = {
8484
* toggled keyboard.)
8585
*
8686
* 2. The composer-inset SharedValue (via `useKeyboardChatComposerInset`) is
87-
* seeded with a deliberate near-miss of the measured composer height — not
88-
* 0, not the exact value; see the call site for why.
87+
* measured from the composer wrapper in a mount-time useLayoutEffect
88+
* (before paint) and reported as the list's bottom inset; see the call
89+
* site for the seed history.
8990
*
9091
* 3. KeyboardChatScrollView vs. iOS automatic contentInset
9192
* adjustments: must disable both
@@ -158,14 +159,15 @@ export function ChatPanel({
158159
// visual padding) and an imperative `reportContentInset` (drives LegendList
159160
// virtualization). No manual `+ insets.bottom`: the composer owns its
160161
// safe-area band via `pb-safe`, so its measured height already includes it.
161-
// 180 is a deliberate near-miss of the measured composer height: close enough
162-
// that initialScrollAtEnd's bootstrap converges in its frame budget, but ≠ the
163-
// exact value and ≠ 0. An exact seed makes the post-measure inset delta zero →
164-
// the bootstrap retarget AND KCSV's useAnimatedReaction both no-op (convergence-
165-
// bounds abort + inset lost on session switch-back); 0 is the other extreme —
166-
// its delta is too large to converge in budget.
162+
// Seed defaults to 0 — the real composer height lands in the hook's mount-time
163+
// useLayoutEffect (before paint) and on every onComposerLayout thereafter. We
164+
// used to seed a near-miss (180) to force the post-measure inset delta non-zero
165+
// so initialScrollAtEnd's bootstrap retarget converged within its frame budget;
166+
// that budget was only ever starved by the drawer-close animation competing for
167+
// frames, and the drawer-settle gate (transitioningSessionId) now defers this
168+
// mount until after the close lands — so a 0 seed converges fine.
167169
const { contentInsetEndAdjustment, onComposerLayout } =
168-
useKeyboardChatComposerInset(listRef, composerRef, 180);
170+
useKeyboardChatComposerInset(listRef, composerRef);
169171

170172
// Idiomatic scroll-on-send (LegendList chat pattern). `scrollMessageToEnd`
171173
// brings the just-sent message into view no matter where the user had

0 commit comments

Comments
 (0)