Skip to content

Remove redundant Rectangle import (and fix linter warning in the same file)#6305

Merged
ckifer merged 2 commits intorecharts:mainfrom
guscost:patch-1
Sep 11, 2025
Merged

Remove redundant Rectangle import (and fix linter warning in the same file)#6305
ckifer merged 2 commits intorecharts:mainfrom
guscost:patch-1

Conversation

@guscost
Copy link
Contributor

@guscost guscost commented Sep 10, 2025

Description

The src/cartesian/Bar.tsx module has a redundant import of the <Rectangle /> component, that gets overwritten by the module-scoped Rectangle data type. This doesn't break any code, but e.g. tsup fails to parse the project without removing it.

Motivation and Context

No change to the package behavior, this is just a quality-of-life improvement to allow tsup to compile typedefs.

How Has This Been Tested?

Unit tests and linter run and pass

Screenshots (if appropriate):

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 VR test, or extended an existing story or VR test to show my changes

@codecov
Copy link

codecov bot commented Sep 10, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.63%. Comparing base (1dfde1e) to head (545da8b).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6305   +/-   ##
=======================================
  Coverage   96.63%   96.63%           
=======================================
  Files         221      221           
  Lines       20287    20287           
  Branches     4157     4157           
=======================================
  Hits        19604    19604           
  Misses        676      676           
  Partials        7        7           

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

};

return <BarRectangle key={`background-bar-${i}`} {...barRectangleProps} />;
return <BarRectangle key={`background-bar-${barRectangleProps.index}`} {...barRectangleProps} />;
Copy link
Member

Choose a reason for hiding this comment

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

These are the same no?

Copy link
Member

Choose a reason for hiding this comment

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

ah, you fixed the linter error by tricking the linter I see. It isn't really fixed per se but 😅

Copy link
Contributor Author

@guscost guscost Sep 16, 2025

Choose a reason for hiding this comment

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

Assigning to barRectangleProps.index helps signal the intent that that value is indeed intended to be a stable key suffix, and/or could be assigned w/ a different scheme, if the array index isn't stable in some mutable-data use case 🤷

@ckifer ckifer merged commit b86fc07 into recharts:main Sep 11, 2025
20 checks passed
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