From 3ee072854f525f07989b6dbbcb09ca50f92e408d Mon Sep 17 00:00:00 2001 From: Esdras Renan Date: Fri, 14 Nov 2025 11:43:09 -0300 Subject: [PATCH] ux: evitar estados intermediarios incorretos no portal e desktop --- apps/desktop/src/main.tsx | 5 ++++- src/components/portal/portal-ticket-list.tsx | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/desktop/src/main.tsx b/apps/desktop/src/main.tsx index 7e038aa..902da12 100644 --- a/apps/desktop/src/main.tsx +++ b/apps/desktop/src/main.tsx @@ -1206,7 +1206,10 @@ useEffect(() => { openSystem() }, [token, status, config?.accessRole, openSystem, tokenValidationTick]) - if (isLaunchingSystem && token) { + // Quando há token persistido (dispositivo já provisionado) e ainda não + // disparamos o auto-launch, exibimos diretamente a tela de loading da + // plataforma para evitar piscar o card de resumo/inventário. + if ((token && !autoLaunchRef.current) || (isLaunchingSystem && token)) { return (
diff --git a/src/components/portal/portal-ticket-list.tsx b/src/components/portal/portal-ticket-list.tsx index 40fead1..cd8f3de 100644 --- a/src/components/portal/portal-ticket-list.tsx +++ b/src/components/portal/portal-ticket-list.tsx @@ -21,7 +21,7 @@ import { } from "@/components/portal/portal-ticket-filters" export function PortalTicketList() { - const { convexUserId, session, machineContext, role } = useAuth() + const { convexUserId, session, machineContext, role, isLoading: authLoading, machineContextLoading } = useAuth() const viewerId = (convexUserId ?? machineContext?.assignedUserId ?? null) as Id<"users"> | null @@ -145,7 +145,7 @@ export function PortalTicketList() { setFilters(defaultPortalTicketFilters) } - const isLoading = Boolean(viewerId && ticketsRaw === undefined) + const isLoading = Boolean(authLoading || machineContextLoading || (viewerId && ticketsRaw === undefined)) if (isLoading) { return (