fix(ui): update/downgrade button now installs correct version

The button was incorrectly calling handleRestart (pure restart) instead
of triggering version install. Now correctly installs latestVersion for
updates or maxStableVersion for downgrades.
This commit is contained in:
kaitranntt
2026-01-05 13:21:31 -05:00
parent a69b2e9d10
commit 48d4a96a62
@@ -172,14 +172,6 @@ export function ProxyStatusWidget() {
})()
: null;
// Restart = stop then start
const handleRestart = async () => {
await stopProxy.mutateAsync();
// Small delay to ensure port is released
await new Promise((r) => setTimeout(r, 500));
startProxy.mutate();
};
// Remote mode: show remote server info
if (isRemoteMode) {
return (
@@ -303,7 +295,12 @@ export function ProxyStatusWidget() {
: hasUpdate &&
'bg-sidebar-accent hover:bg-sidebar-accent/90 text-sidebar-accent-foreground'
)}
onClick={handleRestart}
onClick={() => {
const targetVersion = isUnstable
? updateCheck?.maxStableVersion || versionsData?.latestStable
: updateCheck?.latestVersion;
if (targetVersion) handleInstallVersion(targetVersion);
}}
disabled={isActioning || (!hasUpdate && !isUnstable)}
title={
isUnstable