-
Notifications
You must be signed in to change notification settings - Fork 27k
docs(forms): warn the user about getting old values and show how to a… #50065
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
Conversation
|
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. |
|
@josephperrott can you please add the aio:preview again? Thanks. |
AndrewKushnir
left a comment
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.
@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?
|
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. |
|
@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. |
|
Ok, sure |
|
@AndrewKushnir I agree, the current update of the doc doesn't explain the problem not the solution. |
|
@AndrewKushnir can I tweak your wording and use it in the note? Also, should I leave a similar warning in the reactive forms guide? |
|
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. |
|
Yes ! Parts of the doc (those under |
@sr5434 sure, feel free to use any content from my comment and update it as you see fit.
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.
You can find the docs for the valueChanges and statusChanges here: |
|
@AndrewKushnir is this better? |
|
Hi, you still need to squash your commits ! |
|
Github codespaces won't let me squash them for some reason. Also, I will work on the lining issue. |
…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
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
4c46294 to
3274a39
Compare
|
I have to reopen |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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?
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?