Skip to content

fix(ivy): include NgModule in incremental compilation if template cha… - #31655

Closed
petebacondarwin wants to merge 1 commit into
angular:masterfrom
petebacondarwin:ngtsc-incremental-resource-fix-issue-15122
Closed

petebacondarwin wants to merge 1 commit into
angular:masterfrom
petebacondarwin:ngtsc-incremental-resource-fix-issue-15122

Conversation

@petebacondarwin

Copy link
Copy Markdown
Contributor

…nges

Previously if a template changed then we would know to rebuild its component
source file, but we were not noticing that its NgModule needed rebuilding too.

Now we include resource changes as dependencies when computing which
files are unchanged.

Fixes #31654

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

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

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@petebacondarwin petebacondarwin added type: bug/fix action: review The PR is still awaiting reviews from at least one requested reviewer target: major This PR is targeted for the next major release comp: ivy area: compiler Issues related to `ngc`, Angular's template compiler labels Jul 19, 2019
@petebacondarwin
petebacondarwin requested a review from a team July 19, 2019 13:54
@ngbot ngbot Bot modified the milestone: needsTriage Jul 19, 2019
…nges

Previously if a template changed then we would know to rebuild its component
source file, but we were not noticing that its NgModule needed rebuilding too.

Now we include resource changes as dependencies when computing which
files are unchanged.

Fixes angular#31654
@petebacondarwin
petebacondarwin force-pushed the ngtsc-incremental-resource-fix-issue-15122 branch from d6212de to ca6aaf9 Compare July 19, 2019 14:22
@petebacondarwin

petebacondarwin commented Jul 21, 2019 •

Copy link
Copy Markdown
Contributor Author

@alxhub points out that this is not a performant solution because it forces the whole compilation scope (i.e the ngModule and all its declared components, directives and pipes) to be recompiled just for a single template change.


Note: the problem is that when the ComponentHandler.resolve() function calls this.scopeRegistry.getScopeForComponent(node); it is getting null because this scopeRegistry has been replaced with a clean copy at the start of this incremental compile.


The better solution is to find a way to pass the CompilationScope for the component whose template has changed from the old IncrementalState to the new IncrementalState. But this is complicated as things are architected currently, since the CompilationScope is stored via various mappings inside a MetadataRegistry/Reader and IncrementalState is also a MetadataRegistry/Reader - and these should not really know about each other or their internals.

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

Superceded by #31932

@petebacondarwin
petebacondarwin deleted the ngtsc-incremental-resource-fix-issue-15122 branch August 11, 2019 16:56
@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 Sep 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: compiler Issues related to `ngc`, Angular's template compiler 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.

ng serve in Ivy mode is dropping directives list when editing a template

2 participants