fix: changing startMonth and endMonth makes the calendar disappear - #3005
fix: changing startMonth and endMonth makes the calendar disappear#3005rodgobbi wants to merge 5 commits into
startMonth and endMonth makes the calendar disappear#3005Conversation
|
| ); | ||
|
|
||
| // biome-ignore lint/correctness/useExhaustiveDependencies: change the initial month when the time zone changes. | ||
| useEffect(() => { |
There was a problem hiding this comment.
@gpbl removed this useEffect, lemme if how to verify if it's still needed.
There was a problem hiding this comment.
This effect is still needed :) I added a test to cover the use of the useEffect, and rebased your PR to confirm that removing it breaks an existing feature.
| ); | ||
|
|
||
| // biome-ignore lint/correctness/useExhaustiveDependencies: change the initial month when the time zone changes. | ||
| useEffect(() => { |
There was a problem hiding this comment.
This effect is still needed :) I added a test to cover the use of the useEffect, and rebased your PR to confirm that removing it breaks an existing feature.
8ba44bd to
fb1b33f
Compare
Indeed, we can close #3006.
Thanks for checking 👍 It's ready for review again. 👌 |
fix #2912
Description
The logic has gaps where invalid state, e.g. uncontrolled displayed month state ends outside the valid
startMonthandendMonthrange when they change through props, results in the calendar being unusable.In the reported issue #2912, it disappears.
What's changed
This PR changes the logic to always calculate the displayed first month in the calendar consiring all edge cases and constraints.
Currently, for uncontrolled "selected month" state, it only calculates a valid first month on mount.
This PR calculates it in every render.
Type of Change