Fix GPU inventory typing and user role mapping

This commit is contained in:
Esdras Renan 2025-10-13 13:59:48 -03:00
parent 42611df0f5
commit 4f812a2e4c
3 changed files with 183 additions and 84 deletions

View file

@ -10,8 +10,10 @@ import { Skeleton } from "@/components/ui/skeleton"
export function AdminMachineDetailsClient({ tenantId, machineId }: { tenantId: string; machineId: string }) {
const queryResult = useQuery(api.machines.listByTenant, { tenantId, includeMetadata: true }) as MachinesQueryItem[] | undefined
const isLoading = queryResult === undefined
const machines = queryResult ?? []
const machine = useMemo(() => machines.find((m) => m.id === machineId) ?? null, [machines, machineId])
const machine = useMemo(() => {
if (!queryResult) return null
return queryResult.find((m) => m.id === machineId) ?? null
}, [queryResult, machineId])
if (isLoading) {
return (