diff --git a/admin/inertia/components/TierSelectionModal.tsx b/admin/inertia/components/TierSelectionModal.tsx index 3db5094..255adb3 100644 --- a/admin/inertia/components/TierSelectionModal.tsx +++ b/admin/inertia/components/TierSelectionModal.tsx @@ -96,6 +96,18 @@ const TierSelectionModal: React.FC = ({ // underneath. Cancel returns to the tier modal as-is; Proceed closes both // and runs the original onSelectTier path. const [guardrailVerdict, setGuardrailVerdict] = useState(null) + + // Compute disk-free bytes from system info; 0 means "unknown", which the + // guardrail helper treats as "skip the relative-disk check". + // Must be declared before the `!category` early return so the hook count + // stays constant across renders (category transitions null → non-null when + // the user opens the modal). + const freeBytes = useMemo(() => { + const primary = getPrimaryDiskInfo(systemInfo?.disk, systemInfo?.fsSize) + if (!primary) return 0 + return Math.max(0, primary.totalSize - primary.totalUsed) + }, [systemInfo]) + const ingestPolicy: 'Always' | 'Manual' = ingestPolicySetting?.value === 'Manual' ? 'Manual' : 'Always' @@ -114,14 +126,6 @@ const TierSelectionModal: React.FC = ({ } } - // Compute disk-free bytes from system info; 0 means "unknown", which the - // guardrail helper treats as "skip the relative-disk check". - const freeBytes = useMemo(() => { - const primary = getPrimaryDiskInfo(systemInfo?.disk, systemInfo?.fsSize) - if (!primary) return 0 - return Math.max(0, primary.totalSize - primary.totalUsed) - }, [systemInfo]) - /** * Runs the original onSelectTier-then-onClose flow. Pulled out of * handleSubmit so the guardrail modal's confirm path can call it after diff --git a/admin/inertia/lib/icons.ts b/admin/inertia/lib/icons.ts index cf9484d..75a039d 100644 --- a/admin/inertia/lib/icons.ts +++ b/admin/inertia/lib/icons.ts @@ -32,6 +32,7 @@ import { IconInfoCircle, IconBug, IconCopy, + IconLibrary, IconServer, IconMenu2, IconArrowLeft, @@ -75,6 +76,7 @@ export const icons = { IconDownload, IconHome, IconInfoCircle, + IconLibrary, IconLogs, IconMap, IconMenu2,