Skip to content

Conversation

@simonguo
Copy link
Member

@simonguo simonguo commented Dec 5, 2025

  • Move {...rest} and ref from wrapper element to Component element
  • Align prop forwarding behavior with NavItem and DropdownItem
  • Add test cases for custom component prop forwarding
  • Update composition docs to show direct react-router-dom usage

Fixes #4427

…rumbItem

- Separate BoxProps and component props using extractBoxProps/omitBoxProps
- BoxProps are applied to wrapper element to support layout properties
- Component props (like 'to' for react-router Link) are forwarded to inner element
- Align prop forwarding behavior with NavItem and DropdownItem
- Add test cases for custom component prop forwarding and BoxProps support
- Update composition docs to show direct react-router-dom usage

Fixes #4427
@codesandbox
Copy link

codesandbox bot commented Dec 5, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@simonguo simonguo force-pushed the fix/breadcrumb-item-props-forwarding branch from b8195a6 to 352098c Compare December 5, 2025 10:30
@vercel
Copy link

vercel bot commented Dec 5, 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 10, 2025 8:14am
rsuite-storybook Ready Ready Preview Comment Dec 10, 2025 8:14am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
rsuite-v5 Ignored Ignored Preview Dec 10, 2025 8:14am

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 5, 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.

@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.48%. Comparing base (e295873) to head (d72e776).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4450   +/-   ##
=======================================
  Coverage   94.47%   94.48%           
=======================================
  Files         559      559           
  Lines       13740    13797   +57     
  Branches     4081     4106   +25     
=======================================
+ Hits        12981    13036   +55     
- Misses        687      689    +2     
  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.

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 prop forwarding in BreadcrumbItem when using the as prop to render custom components. The changes ensure that props intended for the inner component (like to for react-router Link) are correctly forwarded, while BoxProps remain on the wrapper element.

Key Changes:

  • Props are now correctly separated between wrapper (BoxProps) and inner component (other props)
  • Ref forwarding moved from wrapper to inner component
  • Test coverage added for custom component prop forwarding scenarios

Reviewed changes

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

File Description
src/Breadcrumb/BreadcrumbItem.tsx Implements prop separation logic using extractBoxProps/omitBoxProps and moves ref forwarding to inner component
src/Breadcrumb/test/BreadcrumbItem.spec.tsx Adds three new test cases for custom component integration and BoxProps handling
docs/pages/guide/composition/en-US/index.md Simplifies react-router-dom example to show direct Link usage without wrapper
docs/pages/guide/composition/zh-CN/index.md Simplifies react-router-dom example (Chinese version)

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


// Separate BoxProps for wrapper and other props for inner component
const boxProps = extractBoxProps(rest);
const componentProps = omitBoxProps(rest);
Copy link

Copilot AI Dec 10, 2025

Choose a reason for hiding this comment

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

The omitBoxProps function doesn't filter out CSS properties (those checked with isCSSProperty). While extractBoxProps includes CSS properties in line 32-34 of src/internals/Box/utils.ts, omitBoxProps only filters out boxPropKeys but not CSS properties. This means CSS properties like color, display, etc. will be forwarded to the custom component through componentProps, which could cause unexpected behavior or invalid props warnings.

Consider also filtering out CSS properties in omitBoxProps, or use a different approach that ensures CSS properties are only applied to the wrapper Box element.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

Copilot AI commented Dec 10, 2025

@simonguo I've opened a new pull request, #4462, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
Contributor

Copilot AI commented Dec 10, 2025

@simonguo I've opened a new pull request, #4463, to work on those changes. Once the pull request is ready, I'll request review from you.

…bItem (#4463)

* Initial plan

* refactor(Breadcrumb): rename WrapperComponent to Wrapper in BreadcrumbItem

Co-authored-by: simonguo <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: simonguo <[email protected]>
…4462)

* Initial plan

* test: add test for active breadcrumb item with custom component

Co-authored-by: simonguo <[email protected]>

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: simonguo <[email protected]>
@vercel
Copy link

vercel bot commented Dec 10, 2025

Deployment failed with the following error:

Resource is limited - try again in 29 minutes (more than 100, code: "api-deployments-free-per-day").

Learn More: https://vercel.com/rsuite?upgradeToPro=build-rate-limit

@simonguo simonguo merged commit 1c39f37 into main Dec 10, 2025
12 of 16 checks passed
@simonguo simonguo deleted the fix/breadcrumb-item-props-forwarding branch December 10, 2025 08:34
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.

[Breadcrumb.Item] does not forward props correctly when used with as={...}

2 participants