fix(chat): open a session already at its end, and keep it there
A session opened from the sidebar could land above the bottom, or show a frame sitting lower and then snap up. The viewport was pinned before the content was final: the recap note renders once the session record arrives and grew the footer under the pinned viewport, and on large sessions subagent task cards grow when their child sessions load, moving everything above the viewport. - The recap note holds the timeline reveal until the session record is in memory, so it is part of the first finished picture. - The scroll hook holds the reveal until the viewport is pinned; the reveal itself runs once the content height has held still for two frames, with one exact pin against the final height (bounded at 300ms). - Sitting on the end of a session that is not producing output is an invariant: content growth re-pins from a MutationObserver in the same frame the list writes its layout, so no frame paints with the end out of view. Output growth keeps gliding through followEnd, which now glides only while the session is working.
This commit is contained in:
@@ -461,6 +461,16 @@ through `Suspense`: a suspended boundary shows its fallback for a tick and
|
||||
React then throttles later-resolving boundaries by ~300ms, which staggered
|
||||
user and assistant text on a cold open.
|
||||
|
||||
An opened session is shown already at its end. The scroll hook holds the gate
|
||||
until the viewport is pinned; the recap note holds it until the session record
|
||||
is in memory, because it cannot decide whether it renders before that and would
|
||||
otherwise grow the footer under a pinned viewport. The reveal itself runs on
|
||||
the next frame after the last hold releases, with one exact pin against the
|
||||
final content height. Afterwards "at the end" is an invariant, not a scroll:
|
||||
while the reader sits on the end of a session that is not producing output,
|
||||
content growth re-pins with one instant write; output growth belongs to the
|
||||
follow logic, which glides only while the session is working.
|
||||
|
||||
`bun run profile:switch` measures both moments; see `scripts/perf/DOCUMENTATION.md`.
|
||||
|
||||
Select leaf values, not containers:
|
||||
|
||||
Reference in New Issue
Block a user