controller: restore Desktop toggle state when a start/stop request fails

Greptile P1: on failure the status poll never re-syncs (the desktop did
not change), so the toggle stayed disabled until remount.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Roland 2026-07-29 15:12:45 -06:00
parent 3e559e1bf8
commit 9e8050bd48
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680

View file

@ -1227,6 +1227,7 @@ export const useDesktop = () => {
}, [status?.desktop_status]);
const localSetDesktop = async (running) => {
const previous = on;
setOn(null);
try {
if (running) {
@ -1242,6 +1243,9 @@ export const useDesktop = () => {
description: e.message || 'Could not start/stop the desktop. See server logs.',
time: 5000,
});
// The desktop did not change, so the status poll will not re-sync `on`;
// restore it or the toggle stays disabled.
setOn(previous);
}
}