You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When DayPicker is used with animate and a controlled month prop, the month transition can glitch if the parent rerenders during onMonthChange.
This is easy to reproduce in the Docusaurus playground when month is synced to external state / query-string state, but it looks like a library-level robustness issue rather than a docs-only issue.
The transition can briefly flicker, jump, overlap, or appear to reset mid-flight.
docusaurus-v9.mov
Expected behavior
Animated month transitions should remain stable when month is controlled, even if the parent rerenders during onMonthChange.
vite-app-v10.mov
Notes
The Docusaurus playground makes this easy to trigger because it syncs props to the URL.
A plain Vite example where month navigation stays internal to DayPicker does not show the same glitch.
This suggests the issue is related to controlled animated navigation under extra rerender pressure.
Suspected cause
src/useAnimation.ts appears to update animation snapshots/refs on every render. In controlled mode, parent rerenders during an ongoing transition may cause the animation bookkeeping to be refreshed from an already animating tree, which can desync the transition state from the DOM.
Possible fixes
Only set up animation state when the displayed month actually changes, not on every rerender.
Keep one stable snapshot per transition and avoid overwriting it while an animation is active.
Add a regression test for animate + controlled month + parent rerender in onMonthChange.
Summary
When
DayPickeris used withanimateand a controlledmonthprop, the month transition can glitch if the parent rerenders duringonMonthChange.This is easy to reproduce in the Docusaurus playground when
monthis synced to external state / query-string state, but it looks like a library-level robustness issue rather than a docs-only issue.Reproduction
Actual behavior
The transition can briefly flicker, jump, overlap, or appear to reset mid-flight.
docusaurus-v9.mov
Expected behavior
Animated month transitions should remain stable when
monthis controlled, even if the parent rerenders duringonMonthChange.vite-app-v10.mov
Notes
DayPickerdoes not show the same glitch.Suspected cause
src/useAnimation.tsappears to update animation snapshots/refs on every render. In controlled mode, parent rerenders during an ongoing transition may cause the animation bookkeeping to be refreshed from an already animating tree, which can desync the transition state from the DOM.Possible fixes
animate+ controlledmonth+ parent rerender inonMonthChange.