Skip to content

HMR for react components fallbacks to full page reloads after touching astro.config.mjs #14993

@mastertheblaster

Description

@mastertheblaster

Astro Info

Astro                    v5.16.4
Node                     v20.19.1
System                   Linux (x64)
Package Manager          unknown
Output                   static
Adapter                  none
Integrations             @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I’m using a simple React component in an Astro page like this:

<Counter {...someProps} client:only="react">
	<h1>Hello, React!</h1>
</Counter>

Initially, when I modify the Counter component, HMR correctly updates only that component.
However, after I edit and save my astro.config.mjs file, Astro restarts and shows:

Configuration file updated. Restarting...

From that point on, any change to the Counter component triggers a full page reload instead of a partial HMR update.

What's the expected result?

I am not really sure if it's a bug or feature. But i would expect partial HMR updates to work.

If this turns out to be a bug and you can point me in the right direction, I’d be happy to open a pull request.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-dudegih8?file=src%2Fpages%2Findex.astro

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageIssue needs to be triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions