-
Notifications
You must be signed in to change notification settings - Fork 106
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
Svelte HMR broken in stories and components #52
Comments
I suspect this was fixed in #53 for Svelte as well? I'll close this issue, if it's actually fixed then we could reopen the issue. |
@eirslett I'm still experiencing this issue in |
Some fixes for svelte were just released. Would folks here like to try out https://github.com/eirslett/storybook-builder-vite/releases/tag/v0.1.16 to see if hot reloading is improved for you, and report back? Thanks! |
I'm using latest versions of |
Thanks for mentioning this, @vish01. I confirmed it's still an issue in our svelte example. I think it's similar to the problem we had with HMR for react components, where we needed to exclude the story files from being HMR boundaries. I've opened a feature request with vite-plugin-svelte to hopefully add an option that lets us customize the HMR boundaries similar to react. For now, the only workaround I can think of is to provide this in your svelteOptions: {
preprocess: preprocess(),
hot: false, // <-- cause page reloads all the time
}, EDIT You shouldn't need this ^ workaround with version 0.1.33 or higher. |
Fixes #52 Svelte story files have the same issue as react story files. The webpack HMR seems to prevent vite's HMR from working correctly, so we need to exclude story files as HMR boundaries in vite. The svelte plugin doesn't expose as nice of a way to do this, but thanks to a suggestion from @domyen in sveltejs/vite-plugin-svelte#321 (comment), I was able to make it work. To test: Start up the svelte example, edit a `.stories.svelte` file, and confirm that the page reloads and shows your changes.
@vish01 Can you please try out the latest version https://github.com/storybookjs/builder-vite/releases/tag/v0.1.33 and let us know if this solves the issue for you? |
Hey @IanVS. I just tried out the |
Hi thanks for checking it out. Unfortunately, that's the best we can do right now, and it's the same experience in react as well. Component changes can HMR, but story file changes require a refresh, due to the storybook manager also watching story files for HMR of the sidebar (list of stories). At least the stories update without requiring a page refresh now, so hopefully a bit better than before. |
Stories do refresh when using the latest version of |
Oh I see, I misunderstood what you were saying earlier. Any chance you could provide a minimal reproduction so I can troubleshoot further? |
@IanVS While creating repro, I found that the issue seems to be happening only when you modify Tailwind classes as props in stories. If I modify normal props like |
Thanks for explaining. I've tested out your example, and I find that as long as I don't change any of the controls in the story, I can edit any of the args, including the I also see that query params are being added to the url like I'm going to re-close this issue for now, but if you think this is a vite-builder specific issue, please let me know. Thanks again for bringing this up, and for the reproduction steps. |
Sounds good, I'll create a new issue on Storybook then. Thanks on checking this for me! |
Changes to story files and component files do not appear in storybook until a full page refresh.
Ref: #3 (comment) and confirmed from another svelte user in discord.
The text was updated successfully, but these errors were encountered: