-
Notifications
You must be signed in to change notification settings - Fork 24.8k
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
fix(ivy): content query results should be available in content hooks #25271
Conversation
You can preview 92fcd23 at https://pr25271-92fcd23.ngbuilds.io/. |
|
||
class WithContentDirective { | ||
// @ContentChildren('foo') foos; | ||
// TODO(issue/24571): remove '!'. | ||
foos !: QueryList<ElementRef>; | ||
foos: QueryList<ElementRef> = null !; |
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.
If you are assigning null
then might as well have the proper type instead of tricking the compiler: foo: QueryList<ElementRef> | null = null
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.
Eh, I'd rather put it up there than have to add a !
below.
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.
That's the thing, you are lying about the type. foos
can be null
since that's what you are assigning to it.
But if you can be sure that this variable is always defined before use, then might as well leave the previous version since it conveys the right meaning.
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.
Fair enough, I think the original was better.
You can preview 82c0525 at https://pr25271-82c0525.ngbuilds.io/. |
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 PR ensures that content queries are refreshed before the
ngAfterContentInit
andngAfterContentChecked
hooks are called.