-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Prevent overcaching of astro components for HMR #5293
Conversation
🦋 Changeset detectedLatest commit: 15652f0 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -24,7 +24,7 @@ export async function handleHotUpdate( | |||
{ config, logging, compile }: HandleHotUpdateOptions | |||
) { | |||
let isStyleOnlyChange = false; | |||
if (ctx.file.endsWith('.astro')) { | |||
if (ctx.file.endsWith('.astro') && isCached(config, ctx.file)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the only change. If the file is not cached then there's no reason to attempt this short-circuit path which will always cause false-positives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Makes total sense, nice catch!
fs.writeFileFromRootSync('/src/components/Header.astro', ` | ||
<h1>{Astro.props.title}</h1> | ||
`); | ||
triggerFSEvent(container, fs, '/src/components/Header.astro', 'change'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love seeing these tests inline 🥇
@@ -24,7 +24,7 @@ export async function handleHotUpdate( | |||
{ config, logging, compile }: HandleHotUpdateOptions | |||
) { | |||
let isStyleOnlyChange = false; | |||
if (ctx.file.endsWith('.astro')) { | |||
if (ctx.file.endsWith('.astro') && isCached(config, ctx.file)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻 Makes total sense, nice catch!
Needs a changeset (maybe?) but LGTM! |
oh yeah, i'll add a changeset |
Changes
Testing
Docs
N/A, bug fix