-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Revert "removes check if initial month was set before" #189
Conversation
This reverts commit 68e991a.
@ljharb this PR reverts previous changes to initial month logic. Sorry about that, please merge this and I'll investigate a better way to solve my use case |
So conceivably, since we want this to happen only on open we could make our check the following: However, this means that the What do you think @ljharb? |
Hmm - I think it makes sense for |
well that's the current behavior. :/ |
In that case I'm not sure what @ViktoriyaSavkina's change is meant to accomplish. @ViktoriyaSavkina, could you elaborate? |
I mean, I think she explained it pretty thoroughly here @ljharb - #176 (comment) I was brainstorming alternative solutions given that we had to revert the initial change. |
Right, but in that case, you'd render it hidden, and then change the initialVisibleMonth and render it visible in the new location, no? |
The |
right but doesn't |
So I was brainstorming ideas for how to handle both @ViktoriyaSavkina's usecase while not introducing unnecessary complication to the users of |
@majapw @ljharb to build on the idea of
This way every time a parent component passes in different value (based on whatever logic) current month for the DayPicker will be updated. Passing the same value in won't make any changes to the initial value of the current month though. |
@ViktoriyaSavkina hm, that's not a bad suggestion. Overall, I'm beginning to think that the concept of "initial visible month" is problematic overall, because of the "initial" - because a prop is being used to initialize state, only once, and because this component needs to be concerned with the business logic about when that prop is copied to state and when not. I'm beginning to think it might be better to deprecate/eliminate the That way, the parent fully controls when the visible month changes, is initially set, or does not change - and the datepicker doesn't need to be concerned with "initial", or with when the prop should be copied to state. Thoughts? |
I like this idea! This way we can maintain existing behavior for the day picker navigation and customize what we want the initial month to be when |
This reverts commit 68e991a.