fix: reset scroll ref on conversation change
prevLengthRef.current was never zeroed when conversationId changed, so the first batch of messages in a new (shorter) conversation would not trigger scrollIntoView. Reset it in the polling useEffect cleanup.
This commit is contained in:
@@ -32,7 +32,7 @@ export default function MessageList({ conversationId, refreshKey }: Props) {
|
||||
load();
|
||||
// ponytail: polling every 3s — replace with WebSocket when server supports it
|
||||
const id = setInterval(load, 3000);
|
||||
return () => { cancelled = true; clearInterval(id); };
|
||||
return () => { cancelled = true; clearInterval(id); prevLengthRef.current = 0; };
|
||||
// Fix 2: refreshKey in deps triggers immediate reload after send
|
||||
}, [conversationId, refreshKey]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user