Skip to content

docs: add page NG8115 (uninvokedTrackFunction) #61962

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

msmallest
Copy link
Contributor

@msmallest msmallest commented Jun 8, 2025

Adds documentation for NG8115 (uninvokedTrackFunction)

Pull request that added the diagnostic:

#60495

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

This adds documentation for the extended diagnostic NG8115 (uninvokedTrackFunction)

  • 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.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

No diagnostic for NG8115 (uninvokedTrackFunction)

Issue Number: N/A

What is the new behavior?

Adds a diagnostic for NG8115 (uninvokedTrackFunction)

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@eneajaho offered to check this out :0 ty

Fun fact: I noticed this while I was just going to make a change for the incorrect indentation that I did in the second commit lol.

Pull request that added the diagnostic:

angular#60495
@angular-robot angular-robot bot added the area: docs Related to the documentation label Jun 8, 2025
@ngbot ngbot bot added this to the Backlog milestone Jun 8, 2025
@msmallest msmallest marked this pull request as ready for review June 8, 2025 18:43
@msmallest
Copy link
Contributor Author

Thank you Enea!

@pullapprove pullapprove bot requested a review from AndrewKushnir June 8, 2025 18:43
Co-authored-by: Matthieu Riegler <kyro38@gmail.com>
@@ -0,0 +1,61 @@
# Uninvoked Track Function

This diagnostic detects when a track function is not called in `@for` blocks.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
This diagnostic detects when a track function is not called in `@for` blocks.
This diagnostic detects when a track function is not invoked in `@for` blocks.

## What's wrong with that?

`@for` blocks need to uniquely identify items in the iterable to correctly perform DOM updates when items in the iterable are reordered, new items are added, or existing items are removed.
Passing just the function name to the track function without invoking the function will make the `@for` loop recreate the list everytime. The function need to be called.
Copy link
Member

Choose a reason for hiding this comment

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

This isn't necessarly true, but instead of the tracking value, the diffing algorithm will get the tracking function reference instead, which usally results in the framework logging the NG0955 warning (https://angular.dev/errors/NG0955)

Comment on lines +25 to +26
Ensure to invoke the track function when you use it in a `@for` to execute the function so the loop can uniquely identify items.

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Ensure to invoke the track function when you use it in a `@for` to execute the function so the loop can uniquely identify items.
Ensure to invoke the track function when you use it in a `@for` block to execute the function so the loop can uniquely identify items.

Copy link

Deployed adev-preview for 559c75f to: https://ng-dev-previews-fw--pr-angular-angular-61962-adev-prev-j0evihb3.web.app

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adev: preview area: docs Related to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants