mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
fix: Replace scrollToIndex with scrollTo to fix scroll jitter (#6780)
This commit is contained in:
parent
c52fdc4397
commit
c99ccf0bb0
1 changed files with 9 additions and 26 deletions
|
|
@ -1334,23 +1334,10 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
|
||||
const scrollToBottomSmooth = useMemo(
|
||||
() =>
|
||||
debounce(
|
||||
() => {
|
||||
const lastIndex = groupedMessages.length - 1
|
||||
if (lastIndex >= 0) {
|
||||
virtuosoRef.current?.scrollToIndex({
|
||||
index: lastIndex,
|
||||
behavior: "smooth",
|
||||
align: "end",
|
||||
})
|
||||
}
|
||||
},
|
||||
10,
|
||||
{
|
||||
immediate: true,
|
||||
},
|
||||
),
|
||||
[groupedMessages.length],
|
||||
debounce(() => virtuosoRef.current?.scrollTo({ top: Number.MAX_SAFE_INTEGER, behavior: "smooth" }), 10, {
|
||||
immediate: true,
|
||||
}),
|
||||
[],
|
||||
)
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -1362,15 +1349,11 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
|
|||
}, [scrollToBottomSmooth])
|
||||
|
||||
const scrollToBottomAuto = useCallback(() => {
|
||||
const lastIndex = groupedMessages.length - 1
|
||||
if (lastIndex >= 0) {
|
||||
virtuosoRef.current?.scrollToIndex({
|
||||
index: lastIndex,
|
||||
behavior: "auto", // Instant causes crash.
|
||||
align: "end",
|
||||
})
|
||||
}
|
||||
}, [groupedMessages.length])
|
||||
virtuosoRef.current?.scrollTo({
|
||||
top: Number.MAX_SAFE_INTEGER,
|
||||
behavior: "auto", // Instant causes crash.
|
||||
})
|
||||
}, [])
|
||||
|
||||
const handleSetExpandedRow = useCallback(
|
||||
(ts: number, expand?: boolean) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue