Skip to content

feat(platform): improve chat markdown rendering and scroll behavior#843

Merged
larryro merged 2 commits into
mainfrom
feat/chat-markdown-improvements
Mar 24, 2026
Merged

feat(platform): improve chat markdown rendering and scroll behavior#843
larryro merged 2 commits into
mainfrom
feat/chat-markdown-improvements

Conversation

@larryro
Copy link
Copy Markdown
Collaborator

@larryro larryro commented Mar 24, 2026

Summary

  • Improve markdown remending to strip empty formatting markers and close open formatting inside incomplete table cells
  • Simplify chat scroll logic and keep chat scrolled to bottom during streaming when user is already at the bottom
  • Add tests for markdown remending utility

Test plan

  • Verify streaming chat messages render without stray asterisks or formatting artifacts
  • Confirm chat auto-scrolls during streaming when scrolled to bottom
  • Confirm chat does not auto-scroll when user has scrolled up
  • Run remend-markdown tests pass

Summary by CodeRabbit

  • Bug Fixes

    • Improved markdown formatting by better handling empty formatting markers in bold, italic, and strikethrough syntax.
    • Enhanced formatting preservation within table cells to ensure proper closure and well-formed table structure.
  • Tests

    • Added comprehensive test coverage for markdown formatting completeness scenarios, including empty marker stripping and in-table formatting preservation.

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

larryro added 2 commits March 24, 2026 09:51
…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.
@larryro larryro force-pushed the feat/chat-markdown-improvements branch from b60eb77 to 226596b Compare March 24, 2026 01:51
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

This 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 remendTable function signature to return an object with consumed status instead of just text.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the two main changes: markdown rendering improvements (remending) and scroll behavior simplification, matching the file modifications across chat components and utilities.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/chat-markdown-improvements

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 | 🟠 Major

Clear auto-follow intent when the user scrolls away from bottom.

scrollingToBottomBehaviorRef is only reset when isAtBottom() is true, so after handleSendMessage sets '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

📥 Commits

Reviewing files that changed from the base of the PR and between 8af8457 and b60eb77.

📒 Files selected for processing (3)
  • services/platform/app/features/chat/components/chat-interface.tsx
  • services/platform/app/features/chat/utils/__tests__/remend-markdown.test.ts
  • services/platform/app/features/chat/utils/remend-markdown.ts

@larryro larryro merged commit 732dd1e into main Mar 24, 2026
17 checks passed
@larryro larryro deleted the feat/chat-markdown-improvements branch March 24, 2026 01:58
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.

1 participant