Skip to content
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

fix(datepicker): not updating calendar state if input changes while open #19973

Merged

Conversation

crisbeto
Copy link
Member

The datepicker was only updating the calendar state that depends on the input when we open and close. I've reworked it so we do it any time one of the input's inputs changes. I also renamed the various _disabledChange streams to _stateChanges which aligns with what we're doing in other components.

Fixes #19959.

@crisbeto crisbeto added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release labels Jul 14, 2020
@crisbeto crisbeto requested a review from mmalerba as a code owner July 14, 2020 19:16
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Jul 14, 2020
@@ -154,7 +155,7 @@ export class MatDateRangeInput<D> implements MatFormFieldControl<DateRange<D>>,

if (newValue !== this._groupDisabled) {
this._groupDisabled = newValue;
this._disabledChange.next(this.disabled);
this._stateChanges.next();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of upcoming rxjs changes we always want to be passing something to next now, e.g. next(null)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it to next(undefined) since some of these are implemented due to MatFormFieldControl which requires a stateChanges: Observable<void>.

src/material/datepicker/datepicker-base.ts Show resolved Hide resolved
@crisbeto
Copy link
Member Author

The feedback has been addressed.

The datepicker was only updating the calendar state that depends on the input when we open and close. I've reworked it so we do it any time one of the input's inputs changes. I also renamed the various `_disabledChange` streams to `_stateChanges` which aligns with what we're doing in other components.

Fixes angular#19959.
@crisbeto crisbeto force-pushed the 19959/datepicker-state-changes branch 2 times, most recently from 40b3dc9 to 07d5152 Compare July 15, 2020 16:30
Copy link
Contributor

@mmalerba mmalerba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mmalerba mmalerba added lgtm action: merge The PR is ready for merge by the caretaker labels Jul 15, 2020
@wagnermaciel wagnermaciel merged commit af6b538 into angular:master Jul 21, 2020
wagnermaciel pushed a commit that referenced this pull request Jul 21, 2020
…pen (#19973)

The datepicker was only updating the calendar state that depends on the input when we open and close. I've reworked it so we do it any time one of the input's inputs changes. I also renamed the various `_disabledChange` streams to `_stateChanges` which aligns with what we're doing in other components.

Fixes #19959.

(cherry picked from commit af6b538)
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(mat-date-picker): changing max date for open datepicker does not update view
4 participants