Conversation
✅ Heimdall Review Status
✅
|
| Code Owner | Status | Calculation | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| ui-systems-eng-team |
✅
1/1
|
Denominator calculation
|
sverg-cb
left a comment
There was a problem hiding this comment.
This looks good to me! 1 question first.
Does this also need to touch the opacity animation? this handles the interpolated path from usePathTransition. transitions could (now) include enterOpacity. is it not necessary to include the opacity transition in the transitionRef?
Or is this already handled by the transition prop in motion.path since the other transitions live in d?
// AnimatedPath in Path.tsx
// ...
const interpolatedPath = usePathTransition({
currentPath: d,
initialPath,
transitions,
});
const animateEnterOpacity = Boolean(transitions?.enterOpacity);
return (
<motion.path
animate={animateEnterOpacity ? { opacity: 1 } : undefined}
d={interpolatedPath}
initial={animateEnterOpacity ? { opacity: 0 } : false}
transition={animateEnterOpacity ? { opacity: transitions?.enterOpacity } : undefined}
{...pathProps}
/>
);|
@sverg-cb great question! We don't need to worry about this here since we are not actively animating the opacity value ourselves on web, we are passing the value onto framer-motion. They are handling it for us, and it works in StrictMode which is great. Not exactly sure what they do under the hood.
They also make it nice and simple for SVG path animations, however we have had issues with their "as long as the two paths are similar" caveat. |

What changed? Why?
This PR improves a few bits of Chart animations
Root cause (required for bugfixes)
We were storing our path svg values in useRef, which doesn't get reset by strict mode. This mixed use of useState, MotionValue, and useRef would cause the initial animation to not render. Now we rely on MotionValue on web to know what the current value is. Wasn't an issue on mobile.
UI changes
Testing
How has it been tested?
Testing instructions
Test out BarChart in strictmode vs not. You can test this locally with storybook. This branch wraps in StrictMode to ensure it works as expected.
Illustrations/Icons Checklist
Required if this PR changes files under
packages/illustrations/**orpackages/icons/**Change management
type=routine
risk=low
impact=sev5
automerge=false