Skip to content

fix: labelRef being passed to DOM node causing warning#6008

Merged
ckifer merged 1 commit into
recharts:mainfrom
saurabhraj123:bugFix/label-ref-passed-in-dom-node-prop-causing-warning
Jun 25, 2025
Merged

fix: labelRef being passed to DOM node causing warning#6008
ckifer merged 1 commit into
recharts:mainfrom
saurabhraj123:bugFix/label-ref-passed-in-dom-node-prop-causing-warning

Conversation

@saurabhraj123

Copy link
Copy Markdown
Contributor

Description

labelRef was being passed to a DOM node. It is not a valid node prop and was causing warning.

Related Issue

#6004
#5880

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • I have added a storybook story or extended an existing story to show my changes

@codecov

codecov Bot commented Jun 25, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.24%. Comparing base (c53716e) to head (cef5e13).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6008      +/-   ##
==========================================
- Coverage   96.24%   96.24%   -0.01%     
==========================================
  Files         194      194              
  Lines       19629    19629              
  Branches     4023     4021       -2     
==========================================
- Hits        18892    18891       -1     
- Misses        731      732       +1     
  Partials        6        6              

☔ 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.

@codecov

codecov Bot commented Jun 25, 2025

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 55 bytes (0.0%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
recharts/bundle-cjs 997.44kB 36 bytes (0.0%) ⬆️
recharts/bundle-es6 860.23kB 19 bytes (0.0%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: recharts/bundle-es6

Assets Changed:

Asset Name Size Change Total Size Change (%)
component/Label.js 19 bytes 15.22kB 0.12%
view changes for bundle: recharts/bundle-cjs

Assets Changed:

Asset Name Size Change Total Size Change (%)
component/Label.js 36 bytes 16.59kB 0.22%

Comment thread src/component/Label.tsx

if (isValidElement(content)) {
return cloneElement(content, props);
return cloneElement(content, filterProps(props, true));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

doesn't this mean it'll also be filtered out if the validElement is Label itself?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

When type is Label, it is being handled inside parseLabel itself.

if (isValidElement(label)) {
    if (label.type === Label) {
      return cloneElement<LabelProps>(label, { key: 'label-implicit', ...commonProps });
    }

    return <Label key="label-implicit" content={label} {...commonProps} />;
  }

@ckifer ckifer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good enough for now thanks for the fix

@ckifer
ckifer merged commit 2005975 into recharts:main Jun 25, 2025
15 checks passed
@PavelVanecek

PavelVanecek commented Jun 25, 2025

Copy link
Copy Markdown
Collaborator

There is now no label being rendered, can it be related to this PR? https://www.chromatic.com/test?appId=63da8268a0da9970db6992aa&id=685bd07ec377767b042a0408

Edit: false alarm, the labels are still there - but delayed. Looks like a VR snapshot problem.

@ckifer

ckifer commented Jun 25, 2025

Copy link
Copy Markdown
Member

@PavelVanecek from what I can see you were right - this is the storybook link from that snapshot https://63da8268a0da9970db6992aa-tzmlwrsuhc.chromatic.com/?path=/story/examples-linechart--with-customized-label

no labels no matter the delay @saurabhraj123 can you look?

@saurabhraj123

Copy link
Copy Markdown
Contributor Author

@PavelVanecek from what I can see you were right - this is the storybook link from that snapshot https://63da8268a0da9970db6992aa-tzmlwrsuhc.chromatic.com/?path=/story/examples-linechart--with-customized-label

no labels no matter the delay @saurabhraj123 can you look?

checking

ckifer pushed a commit that referenced this pull request Jun 26, 2025
<!--- Provide a general summary of your changes in the Title above -->

## Description
Fix: label not being rendered due to filterProps

## Related Issue
#6008 

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->

## Screenshots (if appropriate):
Fix:

<img width="1430" alt="Screenshot 2025-06-26 at 10 11 53 AM"
src="https://github.com/user-attachments/assets/1a5915fb-9031-41e0-8b16-8ded115f896e"
/>

## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] I have added a storybook story or extended an existing story to
show my changes
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.

3 participants