@@ -1838,12 +1838,12 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
18381838 // Live-follow latch. LegendList's maintainScrollAtEnd alone re-pins the feed
18391839 // whenever the viewport drifts back inside its geometric threshold, which
18401840 // yanked users off history they were reading every time a stream chunk grew
1841- // a row. Follow breaks when the user scrolls up and away, and re-arms only
1842- // when the list actually returns to the end (or on send / thread switch) .
1841+ // a row. Scrolling away or expanding a disclosure above the end breaks
1842+ // follow; reaching the end (or sending / switching threads) re-arms it .
18431843 const [ endFollowEnabled , setEndFollowEnabled ] = useState ( true ) ;
18441844 const endFollowEnabledRef = useRef ( true ) ;
18451845 // A "user scroll session" spans from drag start through the end of its
1846- // momentum; only motion inside a session can break follow , so MVCP
1846+ // momentum; scroll events only break follow inside that session , so MVCP
18471847 // compensations and programmatic scrolls never strand a follower.
18481848 const userScrollSessionRef = useRef ( false ) ;
18491849 const setEndFollow = useCallback (
@@ -2271,13 +2271,23 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
22712271 }
22722272 disclosureSettleFrameRef . current = requestAnimationFrame ( ( ) => {
22732273 disclosureSettleSecondFrameRef . current = requestAnimationFrame ( ( ) => {
2274+ // A disclosure can leave the reader above the end without a drag.
2275+ // Reconcile follow before a later layout or resume can re-pin it.
2276+ const listState = props . listRef . current ?. getState ( ) ;
2277+ if ( listState ) {
2278+ transitionEndFollow ( {
2279+ type : "disclosure-settled" ,
2280+ isAtEnd : listState . isAtEnd ,
2281+ userScrollSessionActive : userScrollSessionRef . current ,
2282+ } ) ;
2283+ }
22742284 disclosureAnchorKeyRef . current = null ;
22752285 setDisclosureToggleSettling ( false ) ;
22762286 disclosureSettleFrameRef . current = null ;
22772287 disclosureSettleSecondFrameRef . current = null ;
22782288 } ) ;
22792289 } ) ;
2280- } , [ ] ) ;
2290+ } , [ props . listRef , transitionEndFollow ] ) ;
22812291
22822292 const suspendEndScrollMaintenanceForDisclosure = useCallback ( ( anchorKey : string | null ) => {
22832293 disclosureAnchorKeyRef . current = anchorKey ;
0 commit comments