diff --git a/apps/web/src/cloud/managedRelayState.ts b/apps/web/src/cloud/managedRelayState.ts index 679f362fdf5a0..7efdf9dc63b1f 100644 --- a/apps/web/src/cloud/managedRelayState.ts +++ b/apps/web/src/cloud/managedRelayState.ts @@ -190,10 +190,13 @@ export function useManagedTunnelUsage() { (environment) => environment.endpoint.providerKind === "cloudflare_tunnel", ).length ?? null); const cap = t3Chat.accountId !== null && t3Chat.data ? managedTunnelCap(t3Chat.data) : null; + const firstLoad = (query: { accountId: string | null; data: unknown; isPending: boolean }) => + query.accountId !== null && query.data === null && query.isPending; return { used, limit: cap?.limit ?? null, upgrade: cap?.upgrade ?? null, + loading: firstLoad(environments) || firstLoad(t3Chat), refresh: refreshManagedTunnelUsage, }; } diff --git a/apps/web/src/components/cloud/TunnelUsage.tsx b/apps/web/src/components/cloud/TunnelUsage.tsx index 5fe4f34e8f5ce..f9d170f9dbea4 100644 --- a/apps/web/src/components/cloud/TunnelUsage.tsx +++ b/apps/web/src/components/cloud/TunnelUsage.tsx @@ -8,6 +8,7 @@ import { m, type MessageResolver } from "../../i18n/messages"; import { cn } from "../../lib/utils"; import { Alert, AlertAction, AlertDescription, AlertTitle } from "../ui/alert"; import { Button } from "../ui/button"; +import { Skeleton } from "../ui/skeleton"; // Above this, one slot per tunnel is too thin to read, so the bar fills instead. const MAX_SEGMENTS = 10; @@ -40,6 +41,18 @@ export function tunnelUpgradeCopy( } } +/** Holds the meter's height while usage loads, so the rows below it stay put. */ +export function TunnelUsageMeterSkeleton() { + return ( +
{useRenderedSettingsPathname()}
+General page
, + }), + createRoute({ + getParentRoute: () => root, + path: "/settings/voice", + // Stands in for a lazy route chunk that has not arrived yet. + loader: () => slowPage.promise, + component: () =>Voice page
, + }), + ]), + history: createMemoryHistory({ initialEntries: ["/settings/general"] }), + }); + await using screen = await render(