Simplify and export some of the new animation props#7481
Conversation
WalkthroughRenames the ChangesAnimationHandle Refactor and Public API Surface Expansion
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 17.13kB (0.31%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: recharts/bundle-treeshaking-sankeyAssets Changed:
view changes for bundle: recharts/bundle-treeshaking-polarAssets Changed:
view changes for bundle: recharts/bundle-umdAssets Changed:
view changes for bundle: recharts/bundle-treeshaking-cartesianAssets Changed:
view changes for bundle: recharts/bundle-es6Assets Changed:
view changes for bundle: recharts/bundle-cjsAssets Changed:
view changes for bundle: recharts/bundle-treeshaking-treemapAssets Changed:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/animation/AnimationHandle.ts (1)
116-134: 💤 Low valueConsider adding descriptive error messages to thrown errors.
The bare
throw new Error()at line 125 provides no context when debugging. Since this represents an invariant violation (being in PENDING state withoutbeginStartedTimeset), a descriptive message would help diagnose issues.💡 Suggested improvement
if (this.getState() === PENDING) { if (this.beginStartedTime == null) { - throw new Error(); + throw new Error('beginStartedTime must be set when in PENDING state'); }Similarly for the error at line 139.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/animation/AnimationHandle.ts` around lines 116 - 134, The tick method in the AnimationHandle class contains bare Error throws without descriptive messages, making debugging difficult. Add descriptive error messages to both Error throws in this method: first, replace the Error thrown when beginStartedTime is null in the PENDING state with a message explaining this invariant violation, and second, add a descriptive message to the other Error throw mentioned at line 139. Each error message should clearly explain what state invariant was violated to aid in troubleshooting.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@www/src/docs/apiCates.ts`:
- Around line 108-116: The animation category items array is missing two
exported animation classes that are defined as value exports. Add
JavascriptAnimation and CSSTransitionAnimation to the items array in the
animation category section of the apiCates mapping to ensure these
runtime-exported symbols have corresponding navigation links. Include them in
the items array alongside the existing entries like matchByIndex,
matchByDataKey, and the other animation-related exports.
---
Nitpick comments:
In `@src/animation/AnimationHandle.ts`:
- Around line 116-134: The tick method in the AnimationHandle class contains
bare Error throws without descriptive messages, making debugging difficult. Add
descriptive error messages to both Error throws in this method: first, replace
the Error thrown when beginStartedTime is null in the PENDING state with a
message explaining this invariant violation, and second, add a descriptive
message to the other Error throw mentioned at line 139. Each error message
should clearly explain what state invariant was violated to aid in
troubleshooting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2c8761d1-cb69-497b-8d18-d010f8a642d6
📒 Files selected for processing (18)
omnidoc/verifyExamples.spec.tsscripts/snapshots/es6Files.txtscripts/snapshots/libFiles.txtscripts/snapshots/typesFiles.txtsrc/animation/AnimationController.tssrc/animation/AnimationControllerImpl.tssrc/animation/AnimationHandle.tssrc/animation/CSSTransitionAnimate.tsxsrc/animation/JavascriptAnimate.tsxsrc/animation/timeoutController.tssrc/index.tstest/animation/AnimationController.typed.spec.tstest/animation/AnimationControllerImpl.spec.tstest/animation/CompositeAnimationManager.tstest/animation/MockProgressAnimationManager.tstest/animation/RechartsAnimation.spec.tstest/animation/mockAnimationController.tswww/src/docs/apiCates.ts
| items: [ | ||
| 'matchByIndex', | ||
| 'matchByDataKey', | ||
| 'matchAppend', | ||
| 'interpolate', | ||
| 'AreaRevealShape', | ||
| 'LineDrawShape', | ||
| 'AnimationControllerProvider', | ||
| ], |
There was a problem hiding this comment.
Add missing runtime exports to the animation category.
The JavascriptAnimation and CSSTransitionAnimation are exported as value exports in src/index.ts (line 171) but are missing from this apiCates mapping. According to the omnidoc test in omnidoc/omnidoc.spec.ts, every runtime-exported symbol must appear in apiCates for navigation links to render correctly.
🔧 Add missing exports to apiCates
items: [
'matchByIndex',
'matchByDataKey',
'matchAppend',
'interpolate',
'AreaRevealShape',
'LineDrawShape',
+ 'JavascriptAnimation',
+ 'CSSTransitionAnimation',
'AnimationControllerProvider',
],📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| items: [ | |
| 'matchByIndex', | |
| 'matchByDataKey', | |
| 'matchAppend', | |
| 'interpolate', | |
| 'AreaRevealShape', | |
| 'LineDrawShape', | |
| 'AnimationControllerProvider', | |
| ], | |
| items: [ | |
| 'matchByIndex', | |
| 'matchByDataKey', | |
| 'matchAppend', | |
| 'interpolate', | |
| 'AreaRevealShape', | |
| 'LineDrawShape', | |
| 'JavascriptAnimation', | |
| 'CSSTransitionAnimation', | |
| 'AnimationControllerProvider', | |
| ], |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@www/src/docs/apiCates.ts` around lines 108 - 116, The animation category
items array is missing two exported animation classes that are defined as value
exports. Add JavascriptAnimation and CSSTransitionAnimation to the items array
in the animation category section of the apiCates mapping to ensure these
runtime-exported symbols have corresponding navigation links. Include them in
the items array alongside the existing entries like matchByIndex,
matchByDataKey, and the other animation-related exports.
|
Tip All tests passed and all changes approved!🟢 UI Tests: 198 tests unchanged |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7481 +/- ##
==========================================
- Coverage 88.41% 88.39% -0.03%
==========================================
Files 602 602
Lines 13907 13911 +4
Branches 3514 3514
==========================================
Hits 12296 12296
- Misses 1428 1432 +4
Partials 183 183 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Staging Deployment Details
These deployments will remain available for 30 days. |
I tried to use the new components on our website and turns out the generics were awkward and some names were not so intuitive so I changed things one more time and exported some components that turn out to be quite useful.
Again, not a breaking change, these are not yet released.
Summary by CodeRabbit
New Features
AnimationHandle,JavascriptAnimation,CSSTransitionAnimation,AnimationController,OnAnimationStateUpdate,TimeoutController,CancelableTimeout, andAnimationControllerProviderRefactor
AnimationControllerto a non-generic type systemgetDuration()→getAnimationDuration(),getBeginDelay()→getAnimationBegin()getAnimationStartedTime()andgetBeginStartedTime()Tests
AnimationController