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

fix(ui): scroll to bottom when a prompt is sent #2231

Merged
merged 3 commits into from
May 24, 2024

Conversation

liangfung
Copy link
Collaborator

  1. scroll to bottom when a prompt is sent
    https://jam.dev/c/c7466c7e-8414-4116-a490-2a97c9de66fa

  2. fix the issue where it wasn't automatically scrolling to the bottom during the process of generating an answer

@@ -13,12 +13,13 @@ interface ChatScrollAnchorProps {

export function ChatScrollAnchor({ trackVisibility }: ChatScrollAnchorProps) {
const { container } = React.useContext(ChatContext)
const isAtBottom = useAtBottom(0, container)
const isAtBottom = useAtBottom(100, container)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding an offset here as a buffer, because element heights may suddenly change during the generate process, especially when generating code blocks.

@liangfung liangfung requested review from wsxiaoys and wwayne May 23, 2024 13:59
@liangfung liangfung marked this pull request as ready for review May 23, 2024 13:59
@wsxiaoys wsxiaoys merged commit eb0128f into main May 24, 2024
4 checks passed
@wsxiaoys wsxiaoys deleted the fix-ui-scroll-after-send-user-prompt branch May 24, 2024 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants