Skip to content

Conversation

@simonguo
Copy link
Member

@simonguo simonguo commented Dec 8, 2025

  • Extract name prop in Rate component to prevent it from being passed to StyledBox
  • Add data-name attribute to preserve form field name for debugging
  • Rename internal name prop to componentName in StyledBox to avoid conflicts
  • Add comprehensive tests for Rate component with Form.Control integration
  • Update form documentation example to use field- prefix for all field names

Fixes the issue where size prop was not applied correctly when Rate is used with Form.Control, similar to the previous Picker components fix. #4440

- Extract name prop in Rate component to prevent it from being passed to StyledBox
- Add data-name attribute to preserve form field name for debugging
- Rename internal name prop to componentName in StyledBox to avoid conflicts
- Add comprehensive tests for Rate component with Form.Control integration
- Update form documentation example to use field- prefix for all field names

Fixes the issue where size prop was not applied correctly when Rate is used
with Form.Control, similar to the previous Picker components fix.
@codesandbox
Copy link

codesandbox bot commented Dec 8, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@vercel
Copy link

vercel bot commented Dec 8, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
rsuite-main Ready Ready Preview Comment Dec 8, 2025 8:39am
rsuite-storybook Ready Ready Preview Comment Dec 8, 2025 8:39am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rsuite-v5 Ignored Ignored Preview Dec 8, 2025 8:39am

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 8, 2025

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an issue where the name prop from Form.Control was being passed through to StyledBox, preventing size and color styles from being applied correctly on the Rate component.

  • Extracts and excludes the name prop in Rate component to prevent it from overriding internal styling
  • Renames the internal name parameter to componentName in StyledBox for clarity
  • Adds data-name attribute to Rate for debugging and form field identification
  • Includes comprehensive tests verifying the fix works with Form.Control integration

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/internals/StyledBox/StyledBox.tsx Renames destructured name prop to componentName to clarify its purpose as a CSS variable identifier rather than a DOM attribute
src/Rate/Rate.tsx Extracts name prop and adds it as data-name attribute to prevent conflicts with StyledBox's internal styling mechanism
src/Rate/test/Rate.spec.tsx Adds tests verifying size styles apply correctly when Rate is used with Form.Control and that form integration works properly
docs/pages/components/form/fragments/status.md Updates form field names to use consistent field- prefix throughout the example and demonstrates the Rate component with size prop

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +43 to +44
* Used for form integration and does not affect the internal component styling.
* @private Internal use only - extracted from props to prevent conflicts with StyledBox
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The @private JSDoc tag suggests internal use only, but this prop is part of the public RateProps interface and can be used when Rate is integrated with Form.Control. Consider changing the documentation to clarify that while it's exposed in the interface for form integration purposes, it's extracted internally and doesn't affect styling.

Suggested change
* Used for form integration and does not affect the internal component styling.
* @private Internal use only - extracted from props to prevent conflicts with StyledBox
* Used for form integration (e.g., with Form.Control). This prop is extracted internally and does not affect component styling.
* Exposed in the public interface for form integration purposes.

Copilot uses AI. Check for mistakes.
Comment on lines +17 to +18
/** Element type to render as */
as?: React.ElementType;
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

The as prop is redundant here as it's already inherited from StyledBoxProps (which extends BoxProps, which extends WithAsProps). This explicit declaration can be removed unless there's a specific reason to override the type or documentation.

Suggested change
/** Element type to render as */
as?: React.ElementType;

Copilot uses AI. Check for mistakes.
<Radio value="HTML5">HTML5</Radio>
</FormField>
<FormField name="slider" label="Slider" accepter={Slider} label="Level" />
<FormField name="field-slider" label="Slider" accepter={Slider} label="Level" />
Copy link

Copilot AI Dec 8, 2025

Choose a reason for hiding this comment

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

Duplicate label prop specified twice on the same FormField component. The label prop is set to both "Slider" and "Level", which will result in "Level" overriding "Slider". Remove the duplicate label="Level" or consolidate into a single label prop.

Suggested change
<FormField name="field-slider" label="Slider" accepter={Slider} label="Level" />
<FormField name="field-slider" label="Slider" accepter={Slider} />

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Dec 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.48%. Comparing base (0832f36) to head (267d551).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4455   +/-   ##
=======================================
  Coverage   94.47%   94.48%           
=======================================
  Files         559      559           
  Lines       13740    13740           
  Branches     4081     4081           
=======================================
+ Hits        12981    12982    +1     
+ Misses        687      686    -1     
  Partials       72       72           
Flag Coverage Δ
chromium 94.48% <100.00%> (+<0.01%) ⬆️
firefox 94.48% <100.00%> (+<0.01%) ⬆️

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@simonguo simonguo merged commit f803d01 into main Dec 9, 2025
17 checks passed
@simonguo simonguo deleted the fix/rate-size-prop-with-form-name branch December 9, 2025 05:49
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