File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -246,14 +246,19 @@ function createSessionHistoryWindow(input: SessionHistoryWindowInput) {
246246
247247 if ( added <= 0 ) return
248248 if ( growth <= 0 ) return
249+
250+ if ( opts ?. prefetch ) {
251+ const current = turnStart ( )
252+ preserveScroll ( ( ) => setTurnStart ( current + growth ) )
253+ return
254+ }
255+
249256 if ( turnStart ( ) !== start ) return
250257
251- const reveal = ! opts ?. prefetch
252258 const currentRendered = renderedUserMessages ( ) . length
253259 const base = Math . max ( beforeRendered , currentRendered )
254- const target = reveal ? Math . min ( afterVisible , base + turnBatch ) : base
255- const nextStart = Math . max ( 0 , afterVisible - target )
256- preserveScroll ( ( ) => setTurnStart ( nextStart ) )
260+ const target = Math . min ( afterVisible , base + turnBatch )
261+ preserveScroll ( ( ) => setTurnStart ( Math . max ( 0 , afterVisible - target ) ) )
257262 }
258263
259264 const onScrollerScroll = ( ) => {
You can’t perform that action at this time.
0 commit comments