-
-
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
The min-nights modifiers should get cleared according to the previous prop value not the new one #994
Conversation
2781b68
to
2277896
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without a regression test, I'm not really sure why this was broken nor why this fixes it; no objection to it tho.
👍 on a little more detail and test(s). |
2277896
to
729675b
Compare
… prop value not the new one
729675b
to
7b6b04b
Compare
I added some regression tests! Please take a look @ljharb |
const startDate = today; | ||
const focusedInput = START_DATE; | ||
const minimumNights = 5; | ||
const wrapper = shallow(<DayPickerRangeController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fwiw, the linter will soon require:
const wrapper = shallow((
<DayPickerRangeController
startDate={startDate}
focusedInput={focusedInput}
minimumNights={minimumNights}
/>
));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we'll have to do a wholesale change of... most tests at that point. 😬
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice ! Looks good :)
In addition, we don't seem to be removing the
blocked
modifier from these days at all. Whoops!Here is a gif of the bug in action (not this only happens when you change the min nights value from a bigger value to a smaller value).
Now we will remove min nights blocking according to the previous value and also, any time the value changes (and reapply it for new >0 values).
to: @amhunt @ljharb @erin-doyle