Skip to content

refactor(forms): match getError and hasError to get method signature - #20211

Closed
Toxicable wants to merge 1 commit into
angular:masterfrom
Toxicable:forms-geterror
Closed

Toxicable wants to merge 1 commit into
angular:masterfrom
Toxicable:forms-geterror

Conversation

@Toxicable

Copy link
Copy Markdown

closes #19734

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Feature

What is the current behavior?

getError and hasError mismatch the api of get

Issue Number: #19734

What is the new behavior?

apis match

Does this PR introduce a breaking change?

[ ] Yes
[x] No

@Toxicable Toxicable changed the title feat(forms): match getError has hasError to get's signature feat(forms): match getError and hasError to get's signature Nov 6, 2017
@Toxicable
Toxicable force-pushed the forms-geterror branch 2 times, most recently from dc32358 to e20db06 Compare November 6, 2017 09:01
@vicb vicb added action: review The PR is still awaiting reviews from at least one requested reviewer area: forms labels Nov 6, 2017
@kara kara self-assigned this Nov 30, 2017
@kara kara added the refactoring Issue that involves refactoring or code-cleanup label Nov 30, 2017
@kara kara changed the title feat(forms): match getError and hasError to get's signature refactor(forms): match getError and hasError to get's signature Nov 30, 2017
@kara kara changed the title refactor(forms): match getError and hasError to get's signature refactor(forms): match getError and hasError to get method signature Nov 30, 2017

@kara kara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, but can we also get a test for hasError, since we are changing it here?

@kara kara added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Feb 6, 2018
@kara kara assigned Toxicable and unassigned kara Feb 6, 2018
@Toxicable
Toxicable force-pushed the forms-geterror branch 3 times, most recently from 5a53e61 to 395ff1b Compare February 7, 2018 07:13
@Toxicable

Copy link
Copy Markdown
Author

@kara done

@kara kara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@kara kara added action: review The PR is still awaiting reviews from at least one requested reviewer and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Feb 7, 2018
@kara

kara commented Feb 7, 2018

Copy link
Copy Markdown
Contributor

@IgorMinar API review?

@kara
kara requested a review from IgorMinar February 7, 2018 23:13
@kara kara assigned IgorMinar and unassigned Toxicable Feb 7, 2018
Comment thread packages/forms/src/model.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please update api docs for both methods.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Wasn't sure what to change here so I added a note on how the path can be used.
Let me know if you want something else

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Toxicable I took a look again, but wasn't able to find the docs that you added. Is the commit up to date?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kara Uhhh, I guess not sorry, Ill double check this afternoon

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@kara Added some detail on what the path is meant to be and how to use it

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. I'll let @IgorMinar take one more look though, while it's presubmitting.

Comment thread packages/forms/src/model.ts Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why number? Seems odd. And there are no tests as far as I can tell for using numerical arrays.

@Toxicable Toxicable Feb 8, 2018 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Seams valid if you're traversing through a form array - form arrya being index based.
Ill add some tests.

@kara kara left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. This last change fixed the internal failures (and don't worry about timing, you are still doing better than we are :) ).

@kara

kara commented Dec 21, 2018

Copy link
Copy Markdown
Contributor

@IgorMinar I think it needs one more review from you since the public-API changed again.

@kara kara assigned IgorMinar and unassigned Toxicable Dec 21, 2018
@kara kara added target: major This PR is targeted for the next major release and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Dec 21, 2018

@IgorMinar IgorMinar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you, @Toxicable!!!

@IgorMinar IgorMinar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dang! I just noticed that this PR also needs API docs update. I asked @kara to send a follow up PR so that we don't need to block this, but in the future @Toxicable please do update the API docs.

I also noticed that you wrote a great justification of this change in the issue, but that justification is not available in the commit message, in the future it would be easier for us to review these kinds of changes if the explanation was in the commit message. thank you

@IgorMinar IgorMinar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dang #2!

this commit should have been a feature or a fix since it changes the public api surface
otherwise the change won’t get highlighted in the changelog and nobody will know

@Toxicable

Copy link
Copy Markdown
Author

@IgorMinar I can change it to a fix now if you like?

@kara

kara commented Dec 22, 2018 •

Copy link
Copy Markdown
Contributor

@Toxicable If you can change it to a fix and add the justification to the commit message, that'd be awesome! We can get the PR in sooner. I can add docs in a follow-up so we don't have to go through the whole review process again.

@kara kara added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Dec 22, 2018
Internally getError and hasError call the AbstractControl#get method which takes  `path: Array<string | number> | string` as input, since there are different ways to traverse the AbstractControl tree.
This change matches the method signitures of all methods that use this.
@Toxicable

Copy link
Copy Markdown
Author

@kara done!

@kara kara removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews action: review The PR is still awaiting reviews from at least one requested reviewer labels Dec 22, 2018
@kara kara added the action: merge The PR is ready for merge by the caretaker label Dec 22, 2018
kara added a commit to kara/angular that referenced this pull request Dec 28, 2018
This commit adds docs for the changes made in angular#20211.

Closes angular#19734.
benlesh pushed a commit that referenced this pull request Jan 3, 2019
This commit adds docs for the changes made in #20211.

Closes #19734.

PR Close #27861
@benlesh benlesh closed this in 1b0b36d Jan 3, 2019
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Sep 14, 2019
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 area: forms cla: yes refactoring Issue that involves refactoring or code-cleanup target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change the getError and hasError signature to have more flexibility

6 participants