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

Lazy-loaded circular dependent components break live-reload #18872

Open
scheja opened this issue Sep 24, 2020 · 0 comments
Open

Lazy-loaded circular dependent components break live-reload #18872

scheja opened this issue Sep 24, 2020 · 0 comments

Comments

@scheja
Copy link

@scheja scheja commented Sep 24, 2020

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 9.x

Description

In a specific scenario, changes to component code (template, styles, ts) result in erroneous js and an exception in the browser: ReferenceError: Cannot access 'AComponent' before initialization. In another scenario, a component stops rendering right after a given change in the template. See video for details.

This happens in the following scenario:

  • Routing is used
  • Affected components are lazy-loaded
  • Components are circular dependent, i.e. imaine a tree-like data-structure, where nodes have child-nodes of the same type
  • Components are not directly but indirectly nested: a -> b -> c -> a -> b -> c -> a

Changing anything (e.g. a color in the styles) bricks the live-reloaded app.

🔬 Minimal Reproduction

Repo: https://github.com/scheja/repro-app (Basic app, generated with ng new --routing)
Start with ng serve, go to http://localhost:4200/lazy, then start editing e.g. src/app/lazy/c/c.component.html and watch what happens.
Quick screen recording: https://youtu.be/d7Ch0pEPtNQ

🔥 Exception or Error

ReferenceError: Cannot access 'AComponent' before initialization

🌍 Your Environment

Angular CLI: 10.1.3
Node: 14.10.1
OS: darwin x64

Angular: 10.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.3
@angular-devkit/build-angular   0.1001.3
@angular-devkit/core            10.1.3
@angular-devkit/schematics      10.1.3
@schematics/angular             10.1.3
@schematics/update              0.1001.3
rxjs                            6.6.3
typescript                      4.0.3

Anything else relevant?
Related to: #18183 (this might be the need: repro steps)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.