DEV Community


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

stephenradams_11 profile image
Stephen Adams

I think features like HMR are great and I'm glad the Angular team keep releasing features like this, but to make real use of them devs need to be shown how to use these features properly. It's easy to add HMR but to make sure it's implemented correctly we need to have good tutorials and examples. But I do think hmr has great potential.
Great post Dzhavat 😀

dzhavat profile image
Dzhavat Ushev Author

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 🤷‍♂️🙂