fix(fleet): prevent modal flash when clicking Recheck button (#457)

Use a separate recheckingUpdates state for the Recheck button so the
modal content stays visible while refreshing. The full-screen loading
spinner (checkingUpdates) is now only used for the initial "Check Updates"
open from the header.
This commit is contained in:
Anso
2026-04-09 13:10:50 -04:00
committed by GitHub
parent 1d883f4675
commit 8de82ed81f
+5 -4
View File
@@ -640,6 +640,7 @@ export function FleetView({ onNavigateToNode }: FleetViewProps) {
const [localUpdateConfirm, setLocalUpdateConfirm] = useState<number | null>(null);
const [showUpdateModal, setShowUpdateModal] = useState(false);
const [checkingUpdates, setCheckingUpdates] = useState(false);
const [recheckingUpdates, setRecheckingUpdates] = useState(false);
const [modalSearch, setModalSearch] = useState('');
const updateStatusesRef = useRef(updateStatuses);
updateStatusesRef.current = updateStatuses;
@@ -1352,15 +1353,15 @@ export function FleetView({ onNavigateToNode }: FleetViewProps) {
variant="ghost"
size="sm"
className="h-7 text-xs text-muted-foreground"
disabled={checkingUpdates}
disabled={recheckingUpdates}
onClick={async () => {
setCheckingUpdates(true);
setRecheckingUpdates(true);
await apiFetch('/fleet/update-status?recheck=true', { method: 'DELETE', localOnly: true });
await fetchUpdateStatus();
setCheckingUpdates(false);
setRecheckingUpdates(false);
}}
>
<RefreshCw className={`w-3 h-3 mr-1.5 ${checkingUpdates ? 'animate-spin' : ''}`} strokeWidth={1.5} />
<RefreshCw className={`w-3 h-3 mr-1.5 ${recheckingUpdates ? 'animate-spin' : ''}`} strokeWidth={1.5} />
Recheck
</Button>
{updatableRemoteCount > 0 && (