Skip to content

Mark the ViewRef's insertion LView for check instead of declaration - #33074

Closed
mhevery wants to merge 8 commits into
angular:masterfrom
mhevery:view_ref
Closed

mhevery wants to merge 8 commits into
angular:masterfrom
mhevery:view_ref

Conversation

@mhevery

@mhevery mhevery commented Oct 9, 2019 •

Copy link
Copy Markdown
Contributor

No description provided.

@mhevery mhevery added the area: core Issues related to the framework runtime label Oct 10, 2019
@ngbot ngbot Bot added this to the needsTriage milestone Oct 10, 2019
@googlebot

This comment has been minimized.

@googlebot

This comment has been minimized.

@googlebot

This comment has been minimized.

@googlebot

This comment has been minimized.

@googlebot

This comment has been minimized.

@googlebot

This comment has been minimized.

@atscott
atscott marked this pull request as ready for review October 11, 2019 16:46
@atscott
atscott requested a review from a team October 11, 2019 16:46
@atscott

atscott commented Oct 11, 2019

Copy link
Copy Markdown
Contributor

Presubmit
Ivy Presubmit
Global presubmit from version without the change to markViewDirty - fixed 73 targets. Should still rerun for current PR state

@atscott atscott changed the title View ref Mark the ViewRef's insertion LView for check instead of declaration Oct 11, 2019
@atscott
atscott requested a review from kara October 11, 2019 17:05
@atscott

atscott commented Oct 11, 2019

Copy link
Copy Markdown
Contributor

This is related to the Ivy breaking change "Change Detection Follows Insertion Tree, Not Declaration Tree". In order to update the template at the insertion tree correct, the view ref needs to mark the embedded view as dirty instead of the declaration view. This allows users to use directives that inject ChangeDetectorRef inside an ng-template that is inserted in another context and correctly mark the insertion tree as dirty.

@atscott
atscott requested a review from crisbeto October 11, 2019 17:06
Comment thread packages/core/src/render3/view_ref.ts Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that the _componentLView as a name is misleading here. Let's look at 3 usage scenarios we've got:

  • ChangeDetectorRef - in this particular case _componentLView makes sense;
  • ViewRef created for a dynamic component - _componentLView still makes sense;
  • ViewRef created for an embedded view - _componentLView is misleading here.

How about we leave it as _lView and change the other view from _requestingLView to something clearly indicating that we are dealing with the ChangeDetectorRef case here? Maybe _cdRefInjectingView?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yea, I like this option along with making _cdRefInjectingView optional. The only thing I was hesitant about for making it just _lView again was that it again wasn't describing the different types of LView it could be. I added doc comments for the 3 usage scenarios you listed so I feel better about this now.

@pkozlowski-opensource pkozlowski-opensource left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@atscott ok, I think I've got a much better understanding of the problem right now. There are great moves in this PR (thnx so much for cleaning up ViewRef constructor and removing context and component index fields!).

Still I've left 2 comments regarding names and the (optional) second argument. I believe that we can have a slightly smaller / clearer fix, sth along the lines of pkozlowski-opensource@1817d47

WDYF?

@atscott
atscott force-pushed the view_ref branch 4 times, most recently from 749781a to 6bd87c8 Compare October 18, 2019 16:25

@pkozlowski-opensource pkozlowski-opensource left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thnx!

@kara kara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. We can refactor ViewRef more in a follow-up PR.

@atscott atscott added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Oct 21, 2019
@matsko matsko added the action: presubmit The PR is in need of a google3 presubmit label Oct 22, 2019
@kara kara removed the action: presubmit The PR is in need of a google3 presubmit label Oct 22, 2019
@kara kara closed this in f1ffd57 Oct 22, 2019
kara pushed a commit that referenced this pull request Oct 22, 2019
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Nov 22, 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 area: core Issues related to the framework runtime cla: yes target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants