0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-03 22:57:08 -05:00

fix(#9216): fix style HMR in certain cases (#9219)

This commit is contained in:
Nate Moore 2023-11-29 09:12:43 -06:00 committed by GitHub
parent 1e8d28de7f
commit 067a65f5b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fix edge case where `<style>` updates inside of `.astro` files would ocassionally fail to update without reloading the page.

View file

@ -97,8 +97,8 @@ export async function handleHotUpdate(
// If only styles are changed, remove the component file from the update list
if (isStyleOnlyChange) {
logger.info('astro', msg.hmr({ file, style: true }));
// remove base file and hoisted scripts
return mods.filter((mod) => mod.id !== ctx.file && !mod.id?.endsWith('.ts'));
// Only return the Astro styles that have changed!
return mods.filter((mod) => mod.id?.includes('astro&type=style'));
}
// Add hoisted scripts so these get invalidated