-
Notifications
You must be signed in to change notification settings - Fork 56
fix: XYN-175 chatPage height bug #1079
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
Conversation
Summary of ChangesHello @MayankBansal2004, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves a height bug on the chat page by enhancing the dynamic management of bottom spacing, especially during the streaming of assistant messages. The changes ensure that the chat interface maintains correct padding and layout across different screen sizes as content is generated, improving the overall user experience by preventing visual glitches related to content overflow. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
WalkthroughAdds dynamic bottom-space management to the chat page during streaming by introducing initialBottomSpace, a ResizeObserver-driven adjustment loop, and periodic checks. Tweaks mid-size screen spacing calculation. Updates bottomSpace initialization on new streams. No API or exported type changes. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User
participant ChatPage
participant MessagesContainer
participant ResizeObserver
participant Stream
User->>ChatPage: Start new streaming query
ChatPage->>ChatPage: Compute spaceNeeded (incl. 0.78 factor for mid-size)
ChatPage->>ChatPage: Set bottomSpace = initialBottomSpace = spaceNeeded
ChatPage->>Stream: Begin streaming
Note over ChatPage,Stream: streamingStarted = true
ChatPage->>ResizeObserver: Attach to MessagesContainer
ChatPage->>ChatPage: Start 100ms interval checks
loop While isStreaming
ResizeObserver->>ChatPage: Report content height growth (delta)
ChatPage->>ChatPage: newBottom = max(50px, initialBottomSpace - delta)
alt Change > 10px
ChatPage->>MessagesContainer: Update bottomSpace padding
else No significant change
ChatPage->>ChatPage: Skip update
end
end
Stream-->>ChatPage: Streaming ends
ChatPage->>ResizeObserver: Disconnect
ChatPage->>ChatPage: Clear interval
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request aims to fix a UI bug with the chat page height during message streaming by dynamically adjusting the bottom padding. A new state initialBottomSpace
is introduced and a useEffect
hook is added to manage this adjustment. While the intent is correct, the new useEffect
hook has critical performance issues due to an incorrect dependency array and inefficient polling. I've provided a detailed comment with a suggested refactoring to address these performance problems by using ResizeObserver
more effectively and fixing the dependencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/src/routes/_authenticated/chat.tsx
(3 hunks)
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: MayankBansal2004
PR: xynehq/xyne#765
File: server/api/chat/chat.ts:5706-5712
Timestamp: 2025-09-04T08:53:33.995Z
Learning: MayankBansal2004 prefers to defer technical improvements like input validation and type safety when the current implementation is working, even when acknowledging potential benefits. He takes a pragmatic approach of "if it's not broken, don't fix it" and will revisit improvements when he has bandwidth.
Learnt from: MayankBansal2004
PR: xynehq/xyne#532
File: frontend/src/routes/_authenticated/chat.tsx:1238-1242
Timestamp: 2025-06-16T08:36:57.488Z
Learning: MayankBansal2004 prefers to keep working implementations even when security improvements are suggested, but appreciates being made aware of potential security considerations for future reference.
## [3.13.1](v3.13.0...v3.13.1) (2025-10-10) ### Bug Fixes * XYN-175 chatPage height bug ([#1079](#1079)) ([57ce80d](57ce80d))
Description
ChatPage height bug
Testing
tested locally.
Additional Notes
Summary by CodeRabbit