Closed
Description
🚀 Feature request
Command (mark with an x
)
- new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Description
Currently during ng serve --hmr
any change in component styles triggers reinitialization of the whole app. This behavior is far from ideal as route components in most of the apps need to load data asynchronously and their reinitialization triggers this process again, so applying a change in component's styles can't be reviewed immediately (as it should and as it's done in other frameworks like Vue or React).
I've created a reproduction repo:
- Clone it, run
npm ci && npm start
and openlocalhost:4200
- You'll see
Initializing page...
and thenPage ready
.TestPageComponent
simulates data loading in it'sngOnInit
method. - Change this line to something like
background-color: blue
. TestPageComponent
will be reinitialized and you'll be able to review the change only after 3 seconds.
Describe the solution you'd like
I expect changes in component styles to be applied immediately without reinitialization of the host component.
By the way, changes in global styles are applied immediately, as they should.