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
On our project, we're using a grid system that optionally passes us a screenClass prop to tell us what breakpoint we're currently in. We're using that breakpoint to pass a numberOfMonths prop to the DayPickerRangeController to render either two months for desktop or one month for mobile.
When we're doing this, our function initializes as sm, which initially passes numberOfMonths={1}. It's changed to numberOfMonths={2} shortly after once window.innerWidth is captured and the method is run.
Setting it to 1 on initial load breaks adjustDayPickerHeight for a month either 2 or 3 greater than the current one. As it's calculated based off of calendarMonthWeeks, which is only set on componentDidMount right now, that value becomes stale until it's triggered again.
Possible Fix
Adding a check to componentDidUpdate for a variation in numberOfMonths and then triggering setCalendarMonthWeeks again fixes the issue.