fix: preserve single-value line dash gaps during animation#7405
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThis PR fixes the handling of custom odd-length dash patterns in stroke-dasharray animations. A new ChangesDash Pattern Normalization for Animations
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bundle ReportChanges will increase total bundle size by 674 bytes (0.01%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-treeshaking-cartesianAssets Changed:
view changes for bundle: recharts/bundle-cjsAssets Changed:
view changes for bundle: recharts/bundle-es6Assets Changed:
view changes for bundle: recharts/bundle-umdAssets Changed:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7405 +/- ##
=======================================
Coverage 87.49% 87.49%
=======================================
Files 597 597
Lines 14183 14185 +2
Branches 3560 3559 -1
=======================================
+ Hits 12409 12411 +2
Misses 1580 1580
Partials 194 194 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@puneetdixit200 a screenshot or a video is very appropriate here. Can you please show how the animation changes? |
Description
Single-value SVG
strokeDasharraypatterns repeat themselves, sostrokeDasharray="5"should behave like5 5. During the animated line reveal, Recharts currently normalizes odd dash arrays by appending0, which turns5into5 0and removes the visible gap.This normalizes odd dash patterns by repeating the pattern before calculating the animated dash reveal.
Related Issue
Fixes #3588
Motivation and Context
This keeps the entrance animation consistent with SVG stroke-dasharray semantics and prevents a single-value dashed line from rendering as a solid line while it animates.
How Has This Been Tested?
npm run test -- test/cartesian/Line.animation.spec.tsx -t "single-value dash gaps"failed with5px, 0px, 5px, 0px, 0px, 100pxnpm run test -- test/cartesian/Line.animation.spec.tsx -t "single-value dash gaps"npm run test -- test/cartesian/Line.animation.spec.tsxnpm run test -- test/cartesian/Line.spec.tsx -t strokeDasharraynpm run test -- test/cartesian/Line.animation.spec.tsx test/cartesian/Line.spec.tsxnpx eslint src/cartesian/LineDrawShape.tsx test/cartesian/Line.animation.spec.tsxnpm run check-types-libnpm run check-types-testnpm run omnidocnpm run lint(passes with existing warning-level docs example messages)git diff --checkI also ran full
npm run test; it fails locally in unrelated Treemap/Tooltip timer-loop tests and omnidoc timeout tests, while the affected Line test files pass.Screenshots (if appropriate):
N/A
Types of changes
Checklist:
Summary by CodeRabbit
Bug Fixes
Tests