Fix virtualized bottom target after history prepend

Co-authored-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co>
Signed-off-by: npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr <5a968df9a7494b4e019b9ecf739e088ba61097b4312124e9a88ae5b42e3f5f3e@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
npub1t2tgm7d8f995uqvmnm8h88sg3wnpp9a5xysjf6dg3tjmgt3ltulqdp8ehr
2026-06-27 20:53:35 -04:00
parent 16f955760d
commit 8356aa4d21

View File

@@ -38,6 +38,7 @@ type UseLoadOlderOnScrollOptions = {
virtualizer?: {
getVirtualizer: () => ListVirtualizer | null;
indexByMessageId: Map<string, number>;
/** Current rendered item count (timeline rows + day/unread dividers). */
itemCount: number;
/** Live (non-deferred) message count for growth detection during load-older. */
liveMessageCount?: number;
@@ -248,7 +249,7 @@ export function useLoadOlderOnScroll({
const target = resolveTarget({
instance: grew ? instance : null,
abandonedToBottom,
lastIndex: (after?.liveMessageCount ?? previousCount) - 1,
lastIndex: (after?.itemCount ?? virt.itemCount) - 1,
newIndex,
anchorTop,
});