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 broken in certain cases when using the Storyblok integration #4727

Closed
1 task
tony-sull opened this issue Sep 12, 2022 · 12 comments · Fixed by vitejs/vite#10144 or #4802
Closed
1 task

HMR broken in certain cases when using the Storyblok integration #4727

tony-sull opened this issue Sep 12, 2022 · 12 comments · Fixed by vitejs/vite#10144 or #4802
Assignees
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: hmr Related to HMR (scope)

Comments

@tony-sull
Copy link
Contributor

What version of astro are you using?

1.2.2

Are you using an SSR adapter? If so, which one?

NOne

What package manager are you using?

npm

What operating system are you using?

Mac

Describe the Bug

HMR doesn't seem to be triggering updates in components used by the Storyblok integration. Storyblok's API sends down JSON blocks that are mapped back to Astro components based on a component string key

I haven't had a chance to dig deeper into this one yet, but a few early thoughts

  • I'm wondering if having the the string -> component mapping done inside the integration isn't being reflected in the dependency graph in Vite...is this an issue in Astro, the integration, or an API limitation?
  • Confirm that styles are being bundled, if it's related to the component HMR there's a chance that scoped styles are being missed as well

Link to Minimal Reproducible Example

https://stackblitz.com/edit/astro-sdk-demo

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added the - P4: important Violate documented behavior or significantly impacts performance (priority) label Sep 12, 2022
@matthewp matthewp self-assigned this Sep 12, 2022
@matthewp matthewp added the feat: hmr Related to HMR (scope) label Sep 13, 2022
@matthewp
Copy link
Contributor

Here's a reduced version: https://stackblitz.com/edit/github-ql4awq?file=astro.config.mjs,src%2Fpages%2Findex.astro,src%2Fother%2FOther.astro&on=stackblitz

@matthewp matthewp assigned bluwy and unassigned matthewp Sep 14, 2022
@manuelschroederdev
Copy link

Hey @matthewp, should this issue theoretically be fixed with the new 1.2.4 release using Vite 3.1? I've just tested it but the issue remains.

@matthewp
Copy link
Contributor

@manuelschroederdev No, @bluwy and I debugged it and there's another Vite bug that needs to be fixed. @bluwy is working on that now.

@manuelschroederdev
Copy link

Cool, thanks for your hard work!

@bluwy
Copy link
Member

bluwy commented Sep 16, 2022

This one's a rollercoaster by I managed to fix it at vitejs/vite#10144

@manuelschroederdev
Copy link

Looks like vitejs/vite#10144 is getting rather complicated to solve. 👀
An interesting discussion that you're having there.

@bluwy
Copy link
Member

bluwy commented Sep 19, 2022

@manuelschroederdev I've chat with patak today and got it resolved. It's planned for Vite 3.2, which the beta would release next week. So it might take a few weeks to reach stable. Is this currently blocking the Storyblok integration? If so, I can try to fast-path it as a patch release as I think it's a safe change.

@manuelschroederdev
Copy link

Hey @bluwy, that's great news, thanks!
I would not say it's blocking the Storyblok integration per se, but it certainly affects the DX. Having to restart the dev server every time you change a component is not ideal. A patch release would be fantastic and much appreciated, but I can imagine you might have more urgent tasks to work on. 🙂

@bluwy
Copy link
Member

bluwy commented Sep 19, 2022

@manuelschroederdev Vite 3.1.3 is released with the fix! Will update astro to use it.

@manuelschroederdev
Copy link

Wonderful news, thank you 🙏

@matthewp
Copy link
Contributor

@bluwy is there still another fix coming in 3.2? Or is this the only one?

@bluwy
Copy link
Member

bluwy commented Sep 19, 2022

Yeah this is the only one. I tested and Vite 3.1.3 fixes the Storyblok repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly impacts performance (priority) feat: hmr Related to HMR (scope)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants