0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Fix watchfile multiple dev server restart (#12353)

This commit is contained in:
Hippo 2024-11-04 09:19:54 +01:00 committed by GitHub
parent 5751488165
commit 35795a1a54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Fixes an issue in dev server watch file handling that could cause multiple restarts for a single file change.

View file

@ -169,7 +169,9 @@ export async function createContainerWithAutomaticRestart({
// Restart the Astro dev server instead of Vite's when the API is called by plugins.
// Ignore the `forceOptimize` parameter for now.
restart.container.viteServer.restart = () => handleServerRestart();
restart.container.viteServer.restart = async () => {
if (!restart.container.restartInFlight) await handleServerRestart();
};
// Set up shortcuts