Skip to content
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

Closed
timkindberg opened this issue Mar 1, 2016 · 4 comments
Closed

Hot Module Reloading does not retain state in services #369

timkindberg opened this issue Mar 1, 2016 · 4 comments

Comments

@timkindberg
Copy link

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'

@PatrickJS
Copy link
Owner

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

@samuel-kollat
Copy link

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 ?

@PatrickJS
Copy link
Owner

I this working now I just need to push it up later

@PatrickJS
Copy link
Owner

if you use npm start:hmr you will have HMR with state management using a decorator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants