mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
docs: reword signal queries section (#57921)
Reword the Results availability timing section based on the feedback in https://github.com/angular/angular/issues/56866 Fixes #56866 PR Close #57921
This commit is contained in:
@@ -147,7 +147,7 @@ export class App {
|
||||
|
||||
## Results availability timing
|
||||
|
||||
A signal query authoring functions will be executed as part of the directive instance construction. This happens before we could create a query instance and execute the template’s creation mode to collect any matches. As a consequence, there is a period of time where the signal instance was created (and can be read) but no query results could have been collected. By default Angular will return `undefined` (for child queries) or an empty array (for children queries) before results are available. Required queries will throw if accessed at this point.
|
||||
Signal query declaration functions (ex.: `viewChild`) will be executed while the directive is instantiated. This happens before a template is rendered and before Angular can collect any query matches. As a consequence, there is a period of time where the signal instance was created (and can be read) but no query results could have been collected. By default Angular will return `undefined` (for child queries) or an empty array (for children queries) before results are available. Required queries will throw if accessed at this point.
|
||||
|
||||
Angular computes signal-based query results lazily, on demand. This means that query results are not collected unless there is a code path that reads the signal.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user