feat(platform): improve chat markdown rendering and scroll behavior#843
Conversation
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
…ogic Strip empty formatting markers that would render as literal asterisks, and close open formatting inside incomplete table cells. Simplify chat scroll comments and remove redundant auto-scroll branch.
b60eb77 to
226596b
Compare
📝 WalkthroughWalkthroughThis pull request modifies three files in the chat feature module: it removes explanatory comments from the chat interface's scroll coordination logic without changing functional behavior; adds comprehensive test cases for markdown formatting edge cases including empty formatting markers and formatting within table cells; and refactors the markdown remending logic to close formatting tokens (bold, italic, strikethrough) inside table cells rather than after the row, updating the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
services/platform/app/features/chat/components/chat-interface.tsx (1)
224-229:⚠️ Potential issue | 🟠 MajorClear auto-follow intent when the user scrolls away from bottom.
scrollingToBottomBehaviorRefis only reset whenisAtBottom()is true, so afterhandleSendMessagesets'smooth', manual upward scrolling can still get overridden by subsequent content mutations. This violates the “no auto-scroll when user scrolled up” requirement.Proposed fix
@@ - const onScroll = () => { - if (scrollingToBottomBehaviorRef.current && isAtBottom()) { - scrollingToBottomBehaviorRef.current = null; - } - setShowScrollButton(!isAtBottom()); - }; + const onScroll = () => { + const atBottom = isAtBottom(); + // Stop intentional auto-follow as soon as user is no longer at bottom. + if (scrollingToBottomBehaviorRef.current && !atBottom) { + scrollingToBottomBehaviorRef.current = null; + } + setShowScrollButton(!atBottom); + };Also applies to: 315-315
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@services/platform/app/features/chat/components/chat-interface.tsx` around lines 224 - 229, The current onScroll leaves scrollingToBottomBehaviorRef.current set when the user manually scrolls up, so auto-follow can still trigger; update onScroll to clear scrollingToBottomBehaviorRef.current whenever isAtBottom() is false (i.e., user scrolled away) and still call setShowScrollButton(!isAtBottom()); apply the same change to the other scroll handler referenced around line 315 so any manual scroll clears the auto-follow intent set by handleSendMessage/scrollingToBottomBehaviorRef.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@services/platform/app/features/chat/components/chat-interface.tsx`:
- Around line 224-229: The current onScroll leaves
scrollingToBottomBehaviorRef.current set when the user manually scrolls up, so
auto-follow can still trigger; update onScroll to clear
scrollingToBottomBehaviorRef.current whenever isAtBottom() is false (i.e., user
scrolled away) and still call setShowScrollButton(!isAtBottom()); apply the same
change to the other scroll handler referenced around line 315 so any manual
scroll clears the auto-follow intent set by
handleSendMessage/scrollingToBottomBehaviorRef.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: da926113-31c7-4b28-a3cb-e7613db4d978
📒 Files selected for processing (3)
services/platform/app/features/chat/components/chat-interface.tsxservices/platform/app/features/chat/utils/__tests__/remend-markdown.test.tsservices/platform/app/features/chat/utils/remend-markdown.ts
Summary
Test plan
Summary by CodeRabbit
Bug Fixes
Tests