Skip to content

Conversation

@sr5434
Copy link
Contributor

@sr5434 sr5434 commented Apr 28, 2023

This edit addresses issue #49898

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

There is no warning about trying to access the value of a form control using FormGroup.FormControl.value. Doing this can result in getting old values.
Issue Number: #49898

What is the new behavior?

Advises the user to use FormGroup.controls.FormCOntrol.value.

Does this PR introduce a breaking change?

  • Yes
  • No

@pullapprove pullapprove bot requested a review from AndrewKushnir April 28, 2023 13:29
@ngbot ngbot bot added this to the Backlog milestone Apr 28, 2023
@github-actions
Copy link

Deployed aio for ecbbdf13d84d818b3df8c1fe8c37d471bbc4d314 to: https://ng-dev-previews-fw--pr-angular-angular-50065-dasljljk.web.app

Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt.

@sr5434
Copy link
Contributor Author

sr5434 commented Apr 28, 2023

@josephperrott can you please add the aio:preview again? Thanks.

Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

@sr5434 thanks for creating a PR.

I'm a bit confused on what this warning refers to. I think it might be helpful in some context, but the proposed change just adds it at the very top of the reactive forms guide. What is a use-case in which this warning becomes relevant?

@sr5434
Copy link
Contributor Author

sr5434 commented Apr 28, 2023

In the issue, the author mentions, “on change of field1 or field2 you want to automatically change field 3.” And says, “This doesn't work, since the parent isn't yet updated when the call back is called.” I can add in this example use case if you want.

@AndrewKushnir
Copy link
Contributor

@sr5434 thanks for additional info. I think the best place for this information would be API documentation for valueChanges and stateChanges, i.e. https://angular.io/api/forms/AbstractControl#valueChanges. A note that we can add there can mention that the emit happens when a value of a given control changes. Parent controls are updated after that, so if you try to access parent control value from the valueChanges or stateChanges callback - it might have an old value.

@sr5434
Copy link
Contributor Author

sr5434 commented Apr 28, 2023

Ok, sure

@yelhouti
Copy link
Contributor

@AndrewKushnir I agree, the current update of the doc doesn't explain the problem not the solution.
But I think we should do the explanation (also?) in the file modified by this PR since this is the place where people learn about reactive forms.

@sr5434
Copy link
Contributor Author

sr5434 commented May 1, 2023

@AndrewKushnir can I tweak your wording and use it in the note? Also, should I leave a similar warning in the reactive forms guide?

@sr5434
Copy link
Contributor Author

sr5434 commented May 1, 2023

Also, I can't seem to find a place to edit that specific doc. It sends me to a source file but not the markdown file with the content, and I can't find it in the repo.

@JeanMeche
Copy link
Member

Yes ! Parts of the doc (those under /api/ in the url) are generated from the source files !

@AndrewKushnir
Copy link
Contributor

can I tweak your wording and use it in the note?

@sr5434 sure, feel free to use any content from my comment and update it as you see fit.

should I leave a similar warning in the reactive forms guide?

I don't think this information would be helpful in the reactive guide. The guide talks more about features in general and this use-case is quite specific and can be covered in the API documentation.

Also, I can't seem to find a place to edit that specific doc. It sends me to a source file but not the markdown file with the content, and I can't find it in the repo.

You can find the docs for the valueChanges and statusChanges here:
https://github.com/angular/angular/blob/main/packages/forms/src/model/abstract_model.ts#L585-L600

@sr5434
Copy link
Contributor Author

sr5434 commented May 3, 2023

@AndrewKushnir is this better?

@JeanMeche
Copy link
Member

Hi, you still need to squash your commits !

@sr5434
Copy link
Contributor Author

sr5434 commented May 3, 2023

Github codespaces won't let me squash them for some reason. Also, I will work on the lining issue.

sr5434 and others added 11 commits May 3, 2023 15:26
…r components (angular#50046)

This commit adds similar handling to what was done in angular@ed817e3.
The language service calls the `getDiagnosticsForComponent` function
when the file is not a typescript file.

fixes angular/vscode-ng-language-service#1881

PR Close angular#50046
…lar#50045)

This commit adds back `ngcc` as a no-op operation. When invoked it will warn providing details about removing `ngcc`.

In Angular 17, this will be removed.

PR Close angular#50045
See associated pull request for more information.

PR Close angular#50067
This commit introduces an interface for `toSignal` options to mirror that of
`toObservable`, and adjusts docs for both symbols. It also adds the ability
for `toSignal` to manually specify `DestroyRef` (similarly to
`toObservable` accepting an injector) or for `toSignal` automatic cleanup to
be disabled (in which case the subscription persists until the Observable
completes). Either option allows `toSignal` to be used outside of a DI
context, like `toObservable`.

PR Close angular#50071
Adds the developer preview signals guide to AIO, under the preview section.
This guide explains signals, computed properties, and effects.

PR Close angular#50053
… doc (angular#50042)

These two concepts are a crucial addition to component destruction, and are added to the existing lifecycle doc (which is retitled more generally).

PR Close angular#50042
Create a new Signals section on aio, and add an interop guide.

PR Close angular#50039
The Web worker platform was removed in v11.
`isPlatformWorkerApp` & `isPlatformWorkerUi` have no purpose since.

PR Close angular#50055
…-dynamic` (angular#50064)

Using `@angular/platform-browser-dynamic` is no longer required for JIT scenarios with Ivy. Instead `@angular/compiler` should be imported instead.

This change is part of the effort to reduce the server bundles sizes, which is needed to support cloud workers.

BREAKING CHANGE:
Users that are using SSR with JIT mode will now need to add  `import to @angular/compiler` before bootstrapping the application.

**NOTE:** this does not effect users using the Angular CLI.

PR Close angular#50064
MarkTechson and others added 18 commits May 3, 2023 15:26
Adds files for the 03 lesson and updated the 02 lesson in some places where the language was incorrect or unclear

PR Close angular#49980
Update the tutorial for lesson 04 on interfaces. Also added images required for the base app. Created the placeholder for the next lesson so the app works if built from this branch. Updated navigation to include this step in the navigation menu.

PR Close angular#49980
This commit does the following:
- Add the instructional content for lesson 05
- Add an entry to navigation.json for this lesson
- Adds doc regions to the housing-location.component file
- Adds a placeholder for lesson 06 (that way links work now)

PR Close angular#49980
Each individual lesson should have the images available in the download since a learner can start from any lesson. So, we're adding images here. Also, sync'ing styles for consistency across the lessons. This is fixing some previous commits that didn't include these changes. The goal is that for future commits we can have less changes and focused solely on that lesson

PR Close angular#49980
Adds lesson 06 as well as fixes up some code inconsistencies. Adds docregions to some lessons and adds a missed step, misspellings and more to previous lessons.

PR Close angular#49980
Adds the content for lesson 07, a new image, a navigation entry and some updates to the example code for this lesson. Also, this updates previous lessons where typos and copy/pasta errors show up

PR Close angular#49980
Adds lesson 8, some images, fixes a typo and adds the required navigation item

PR Close angular#49980
Updates the content of the lesson and adds a placeholder for the next lesson. Also, updates the code for the example to reflect the patterns from the previous iterations.

PR Close angular#49980
Updated the content for the tutorial lesson 10, added doc regions to the code and updated the service. Also added a placeholder for lesson 11.

PR Close angular#49980
Add content for lesson 11. Update previous lessons and code examples be in line with the latest lesson formatting.

PR Close angular#49980
Add content for tutorial lesson 12 and update the code examples.

PR Close angular#49980
Adds the content for lesson 13, fixes some code inconsistencies for the services code in the examples, and adds this lesson to the navigation.

PR Close angular#49980
Adds the content for lesson 14, updates a mistake in lesson 13, and updates the tutorial index page.

PR Close angular#49980
Update the introduction page to include a link to the new tutorial and to remove links to the other tutorials to give learners a clearer path forward. Also, add files to pull approve.

PR Close angular#49980
@sr5434 sr5434 force-pushed the reactive-forms-warning branch from 4c46294 to 3274a39 Compare May 3, 2023 15:29
@angular-robot angular-robot bot added detected: breaking change PR contains a commit with a breaking change area: build & ci Related the build and CI infrastructure of the project labels May 3, 2023
@sr5434
Copy link
Contributor Author

sr5434 commented May 3, 2023

I have to reopen

@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 Jun 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: build & ci Related the build and CI infrastructure of the project detected: breaking change PR contains a commit with a breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.