mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-08-10 10:49:35 +00:00
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:
@@ -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 && (
|
||||
|
||||
Reference in New Issue
Block a user