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

HMR clears the component state #6308

Closed
haskelcurry opened this issue Mar 27, 2019 · 12 comments
Closed

HMR clears the component state #6308

haskelcurry opened this issue Mar 27, 2019 · 12 comments

Comments

@haskelcurry
Copy link

I use Angular Storybook. When I change something slightly (i.e. the component's SCSS), the input fields of my simple component get cleared, and the whole state is lost.

To Reproduce
Steps to reproduce the behavior:
1.

storiesOf('Input', module)
  .add('with text', () => ({
    template: '<input/>'
  }))
  1. In Storybook app, insert some text in the input field
  2. Change something not related to this component
  3. The text gets cleared. The config is among the [HMR] updates:
[HMR]  - ./.storybook/config.js

Expected behavior
The state of inputs should persist. That's what the HMR for, not just for live reloading.

System:

  • OS: Arch Linux
  • Browser: chrome
  • Framework: angular
  • Version: 5.0.5
@haskelcurry
Copy link
Author

haskelcurry commented Apr 12, 2019

Any thoughts or comments on this? Does it work for anybody else? Does it behave in same way in React version?

@shilman
Copy link
Member

shilman commented Apr 12, 2019

cc @kroeder @CodeByAlex @jonrimmer

@jonrimmer
Copy link
Contributor

@mtuzinskiy This may have been fixed by #6094. Can you test using @storybook/angular version 5.1.0-alpha.25 and see if it still happens?

@haskelcurry
Copy link
Author

@jonrimmer That would be great! I tried to update the @storybook/angular in basic example to 5.1.0-alpha.25 and got this:

Provider.renderPreview() is not implemented!

@shilman
Copy link
Member

shilman commented Apr 12, 2019

@mtuzinskiy can you try clearing your node_modules and possibly your yarn.lock?

@haskelcurry
Copy link
Author

@shilman Yes that was it. But unfortunately it didn't solve the problem. I created the sample project, which uses 5.1.0-alpha.25:
https://github.com/mtuzinskiy/storybook-hmr-temp
To reproduce, please clone it, run yarn install and then yarn storybook.
It'll render the simplistic Input component.
Enter anything in the input, and then change the margin: value in input.component.scss. You'll see that the input gets cleared.

@stale stale bot added the inactive label May 4, 2019
@stale stale bot closed this as completed Jun 3, 2019
@haskelcurry
Copy link
Author

@shilman Can we please reopen it?..

@shilman shilman reopened this Jun 3, 2019
@stale stale bot removed the inactive label Jun 3, 2019
@shilman shilman modified the milestones: 5.0.x, 5.1.x Jun 5, 2019
@stale stale bot added the inactive label Jun 26, 2019
@haskelcurry
Copy link
Author

Yes it's still a bug

@stale stale bot removed the inactive label Jun 26, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 11, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 11, 2019
@storybookjs storybookjs deleted a comment from stale bot Jul 11, 2019
@ndelangen
Copy link
Member

@jonrimmer could you have a look at this repro?
#6308 (comment)

@stale stale bot added the inactive label Aug 1, 2019
@storybookjs storybookjs deleted a comment from stale bot Aug 1, 2019
@stale stale bot removed the inactive label Aug 1, 2019
@stale stale bot removed the inactive label Aug 1, 2019
@shilman shilman modified the milestones: 5.1.x, 5.2.x Sep 23, 2019
@shilman shilman modified the milestones: 5.2.x, 5.3.x Jan 11, 2020
@danawoodman
Copy link

AFAIK, this seems to still be an issue, at least for me with a React application using the latest packages.

@deanrad
Copy link

deanrad commented Mar 19, 2020

Yes, CodeSandbox does this safely, but Storybook doesn't (as of 5.3.9)

@shilman shilman removed this from the 5.3.x milestone Jul 30, 2020
@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented May 8, 2023

Please provide a reproduction for Storybook 7. I will close this. Feel free to reopen it, if it is still not working.

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

7 participants