Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

kara
Copy link
Contributor

@kara kara commented Aug 2, 2018

This PR ensures that content queries are refreshed before the ngAfterContentInit and ngAfterContentChecked hooks are called.

@kara kara added type: bug/fix action: review The PR is still awaiting reviews from at least one requested reviewer comp: ivy labels Aug 2, 2018
@kara kara requested a review from mhevery August 2, 2018 21:34
@mary-poppins
Copy link

You can preview 92fcd23 at https://pr25271-92fcd23.ngbuilds.io/.

@kara kara added target: major This PR is targeted for the next major release and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Aug 2, 2018
@kara
Copy link
Contributor Author

kara commented Aug 2, 2018

presubmit


class WithContentDirective {
// @ContentChildren('foo') foos;
// TODO(issue/24571): remove '!'.
foos !: QueryList<ElementRef>;
foos: QueryList<ElementRef> = null !;
Copy link
Contributor

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

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@mary-poppins
Copy link

You can preview 82c0525 at https://pr25271-82c0525.ngbuilds.io/.

@kara kara added the action: merge The PR is ready for merge by the caretaker label Aug 2, 2018
@kara kara closed this in 1fb7111 Aug 3, 2018
FrederikSchlemmer pushed a commit to FrederikSchlemmer/angular that referenced this pull request Jan 3, 2019
@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 Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes target: major This PR is targeted for the next major release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants