studio/frontend: keep shutdown dialog open when server-stop fails
`AlertDialogAction` from Radix auto-closes the AlertDialog on click (documented behavior). The shutdown handler then runs async, and on error calls `toastError(...)` + `setStopping(false)` to reset the button label for a retry, but the dialog has already vanished by then. The user sees a flash + a toast and has to re-navigate through the user-menu to try again. Fix: call `event.preventDefault()` in the AlertDialogAction onClick so the dialog stays open while the request is in flight. On success the handler replaces document.body wholesale, so dialog open-ness doesn't matter. On failure the dialog stays open with the reset "Stop server" label, ready for retry. Probe: scripts/r6_shutdown_dialog_probe.py — intercepts /api/shutdown to return 500, asserts dialog still open + button label resets to "Stop server".
This commit is contained in:
parent
6c52697ad0
commit
00cc20baa1
1 changed files with 9 additions and 1 deletions
|
|
@ -72,7 +72,15 @@ export function ShutdownDialog({
|
|||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction
|
||||
onClick={handleStop}
|
||||
onClick={(event) => {
|
||||
// AlertDialogAction auto-closes the dialog by default.
|
||||
// On the shutdown error path we toast + reset `stopping`
|
||||
// to let the user retry, which only works if the dialog
|
||||
// stays open. preventDefault keeps it open; on success
|
||||
// the handler replaces document.body anyway.
|
||||
event.preventDefault();
|
||||
void handleStop();
|
||||
}}
|
||||
disabled={stopping}
|
||||
variant="destructive"
|
||||
>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue