Hot reload doesn't keep state when multiple static files are changed at once
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 290
Description
### Is there an existing issue for this?
- [X] I have searched the existing issues
### Describe the bug
When using `dotnet watch` and a bundler like vite to bundle and minify assets, the hot reload fails to keep the state of HTML elements like form inputs.
For example:
Given a form like:

Updating the css to explicitly set the background color of inputs to white triggers multiple files to update.
```
dotnet watch ⌚ Files changed: .\wwwroot\assets\js\chunks\asyncExample.js, .\wwwroot\assets\asyncExample.css, .\wwwroot\assets\js\main.js, .\wwwroot\assets\main.css
dotnet watch 🔥 Hot reload of static file succeeded.
dotnet watch 🔥 Hot reload of static file succeeded.
dotnet watch 🔥 Hot reload of static file succeeded.
dotnet watch 🔥 Hot reload of static file succeeded.
```
This results in the form losing it's state.

However if only one type of file (eg. .css) changes then it works as expected. And the form keeps its current state while updating the styling. To illustrate this I've added this item group to my .csproj file.
```
```

Changing the background color again.
```
dotnet watch ⌚ Files changed: .\wwwroot\assets\asyncExample.css, .\wwwroot\assets\main.css
dotnet watch 🔥 Hot reload of static file succeeded.
dotnet watch 🔥 Hot reload of static file succeeded.
```

### Expected Behavior
When only static assets change i expect the form state to remain the same
### Steps To Reproduce
_No response_
### Exceptions (if any)
_No response_
### .NET Version
8.0.200
### Anything else?
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.