Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Refactor thread state management #4350

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
chore: clean states
  • Loading branch information
louis-jan committed Dec 29, 2024
commit d033c10b27e128db49ef5dd592191d223d95b938
24 changes: 0 additions & 24 deletions web/screens/Thread/ThreadCenterPanel/ChatBody/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,22 +79,6 @@ const ChatBody = memo(
overscan: 5,
})

useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
}
}, [count, virtualizer])

useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current && isBlockingSend) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
}
}, [count, virtualizer, isBlockingSend])

useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current && isBlockingSend) {
Expand All @@ -103,14 +87,6 @@ const ChatBody = memo(
}
}, [count, virtualizer, isBlockingSend, currentThread?.id])

useEffect(() => {
isUserManuallyScrollingUp.current = false
if (parentRef.current) {
parentRef.current.scrollTo({ top: parentRef.current.scrollHeight })
virtualizer.scrollToIndex(count - 1)
}
}, [count, currentThread?.id, virtualizer])

const items = virtualizer.getVirtualItems()

virtualizer.shouldAdjustScrollPositionOnItemSizeChange = (
Expand Down
Loading