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:
parent
5751488165
commit
35795a1a54
2 changed files with 8 additions and 1 deletions
5
.changeset/famous-timers-move.md
Normal file
5
.changeset/famous-timers-move.md
Normal 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.
|
|
@ -169,7 +169,9 @@ export async function createContainerWithAutomaticRestart({
|
||||||
|
|
||||||
// Restart the Astro dev server instead of Vite's when the API is called by plugins.
|
// Restart the Astro dev server instead of Vite's when the API is called by plugins.
|
||||||
// Ignore the `forceOptimize` parameter for now.
|
// 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
|
// Set up shortcuts
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue