Skip to content

Conversation

@simonguo
Copy link
Member

@simonguo simonguo commented Dec 7, 2025

This pull request improves the handling of React Fragments as children in the PanelHeader component, ensuring consistent rendering and wrapping of header content. It also adds a test to verify this new behavior.

Component enhancements:

  • Updated PanelHeader to check for React Fragments using the new isFragment utility and wrap such children in a div with the correct class, ensuring consistent structure for all header content. [1] [2]

Testing improvements:

  • Added a unit test to confirm that when a React Fragment is passed as a child to PanelHeader, its content is correctly wrapped and rendered.

@simonguo simonguo requested a review from Copilot December 7, 2025 11:05
@codesandbox
Copy link

codesandbox bot commented Dec 7, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codesandbox-ci
Copy link

codesandbox-ci bot commented Dec 7, 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 enhances the PanelHeader component to properly handle React Fragments as children by detecting them with a new isFragment utility and wrapping them appropriately. The change also updates the wrapper element from span to div for all non-valid-element children cases.

Key changes:

  • Added fragment detection using the isFragment utility imported from @/internals/utils
  • Changed the wrapper element from span to div for wrapped children (including plain text, arrays, and fragments)
  • Added test coverage to verify fragment children are properly wrapped with the .rs-panel-title class

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Panel/PanelHeader.tsx Imports isFragment utility and updates the children wrapping logic to detect and handle React Fragments, while changing the wrapper element from span to div
src/Panel/test/Panel.spec.tsx Adds test case verifying that React Fragments passed as children are correctly wrapped in a div with the rs-panel-title class

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

@codecov
Copy link

codecov bot commented Dec 7, 2025

Codecov Report

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

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

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.

@vercel
Copy link

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

@simonguo simonguo merged commit 3c6f491 into main Dec 7, 2025
23 checks passed
@simonguo simonguo deleted the fix/panel-header-fragment branch December 7, 2025 11:18
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