PatrickJS / angular-hmr

:fire: Angular Hot Module Replacement for Hot Module Reloading

Home Page:https://patrickjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

it will delete the DOM which are dynamic created?

wuzhouyang opened this issue · comments

In my project i use the Bootstrap, when i open a modal or open the dropdown buttons, i edit some css and save, then the modal will be hided,the dropdown buttons will be shrinked. And i create some DOM dynamically, similarly i edit some css then save,the DOM which i create was disappeared...
i want to know the reason,thnx!!!

hmr is destroying the angular app and bootstrapping the app again with the changes so if you're missing teardown logic in your components then there will be problems. same with not transferring state from one app to the next.

in this lifecycle hook hmrOnDestroy(store)
you need to transfer state into the store during teardown to resume the state for the next app

in this lifecycle hook hmrOnInit(store)
you will get state in the store from the previous app so this is where you would hydrate your app with it to when it bootstraps the app will look the same