Skip to content

Conversation

@dcramer
Copy link
Member

@dcramer dcramer commented Jun 27, 2025

  • Enhance use-scroll-to-bottom hook with smart user scroll detection
  • Reorganize platform/framework constants for better structure
  • Add test for invalid guide parameter validation
  • Improve chat UI component organization

🤖 Generated with Claude Code

@codecov
Copy link

codecov bot commented Jun 27, 2025

Codecov Report

Attention: Patch coverage is 13.92405% with 68 lines in your changes missing coverage. Please review.

Project coverage is 63.86%. Comparing base (3172036) to head (796bf9c).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...loudflare/src/client/hooks/use-scroll-to-bottom.ts 0.00% 68 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #324      +/-   ##
==========================================
- Coverage   64.12%   63.86%   -0.27%     
==========================================
  Files          46       48       +2     
  Lines        5609     5770     +161     
  Branches      471      478       +7     
==========================================
+ Hits         3597     3685      +88     
- Misses       2012     2085      +73     
Flag Coverage Δ
evals 74.54% <ø> (?)
unittests 63.65% <13.92%> (-0.48%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

cursor[bot]

This comment was marked as outdated.

- Enhance use-scroll-to-bottom hook with smart user scroll detection
- Reorganize platform/framework constants for better structure
- Add test for invalid guide parameter validation
- Improve chat UI component organization

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Scroll Detection Hook Runs Unnecessarily

The useEffect hook for initial scroll detection lacks a dependency array, causing it to run on every render. This leads to unnecessary performance overhead as it repeatedly checks scroll conditions and potentially triggers re-renders by calling scrollToBottom(true). The effect should have an empty dependency array [] to execute only once on mount, or include appropriate dependencies.

packages/mcp-cloudflare/src/client/hooks/use-scroll-to-bottom.ts#L66-L81

// Handle initial scroll when container first gets content
useEffect(() => {
const container = containerRef.current;
if (!container) return;
// Check if we have content but haven't scrolled yet
if (
container.scrollHeight > container.clientHeight &&
!hasInitialScrolled.current
) {
hasInitialScrolled.current = true;
// Instant scroll on initial load
scrollToBottom(true);
}
});

Fix in Cursor


Was this report helpful? Give feedback by reacting with 👍 or 👎

@dcramer dcramer merged commit c2b9763 into main Jun 27, 2025
13 checks passed
@dcramer dcramer deleted the improve-prompts branch June 27, 2025 22:35
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.

2 participants