diff --git a/frontend/src/ts/test/test-logic.ts b/frontend/src/ts/test/test-logic.ts index 7029d6810cfb..add387da061d 100644 --- a/frontend/src/ts/test/test-logic.ts +++ b/frontend/src/ts/test/test-logic.ts @@ -200,6 +200,9 @@ export async function restart(options = {} as RestartOptions): Promise { if (isTestRestarting() || isResultCalculating()) { options.event?.preventDefault(); + if (isTestRestarting() && !options.isQuickRestart) { + queuedRestart = { ...options, event: undefined }; + } return; } if (isTestActive()) { @@ -332,6 +335,7 @@ export async function restart(options = {} as RestartOptions): Promise { if (!initResult) { setIsTestRestarting(false); + runQueuedRestart(); return; } @@ -345,6 +349,17 @@ export async function restart(options = {} as RestartOptions): Promise { await TestUI.fadeInAfterRestart(noAnim); setIsTestRestarting(false); + runQueuedRestart(); +} + +let queuedRestart: RestartOptions | null = null; + +// config changed while a restart was running, run again so the new settings apply +function runQueuedRestart(): void { + if (queuedRestart === null) return; + const options = queuedRestart; + queuedRestart = null; + void restart(options); } let lastInitError: Error | null = null;