DEV Community

Discussion on: Things to watch out for when using HMR with Angular

Collapse
 
dzhavat profile image
Dzhavat Ushev

Thanks Stephen.
I agree that HMR is a great feature. I've been working on an Angular app with HMR enabled for a few months now. HMR has probably saved me some valuable time. In terms of doing something because of HMR, I can remember a couple of places where I had to clear a subscription myself in long-lived component(s)/service(s) in order to not introduce memory leaks in development. So that is something one needs to be aware of and actively do something about it. Other than that, as long as subscriptions are handled either by the async pipe or some other way, everything should be working just fine.

Something else I've noticed is that there's some issue when HMR is enabled in a app that uses Angular Material and NgRx but I haven't fully figured it out yet. It's related to those components that use input fields like the date picker. It could as well be an issue on my end. Don't know yet 🤷‍♂️🙂