Skip to content

Hot Module Reloading does not retain state in services #369

@timkindberg

Description

@timkindberg

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'

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions