-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Hot Module Reloading does not retain state in services #369
Comments
I didn't create proxies for any of the components or service because the implementation is a simple one since there are many core changes planned I didn't want to create one only to refactor it many times over. I'm closing this for now to keep the issues down |
Could you point me in the right direction how to hold state in components/services with HMR and also how not to reload whole page/state after CSS (Sass) file update ? |
I this working now I just need to push it up later |
if you use |
With Hot Module Reloading I was expecting that only the file/component that I made a change to would be swapped out. However, if you have a service injected into the changed component that is holding some state, that state is refreshed to it's beginning state again.
Setup:
ServiceA has a data property that starts as 'foo'
ComponentA injects ServiceA as public
ComponentA.template =
<h1>{{serviceA.data}}</h1><button (click)="serviceA.data = 'bar' ">Click</button>
;ComponentA button click changes 'data' to 'bar'.
Steps:
Launch app
Click button
Make an edit to ComponentA
Actual:
h1 shows 'foo'
Expected:
h1 to show 'bar'
The text was updated successfully, but these errors were encountered: