The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Settings: an account's page no longer fails to hydrate
Adarsh32571a2266aa
diff --git a/src/components/accounts-admin.tsx b/src/components/accounts-admin.tsxindex 2310e648..411930d4 100644--- a/src/components/accounts-admin.tsx+++ b/src/components/accounts-admin.tsx@@ -6,7 +6,7 @@ import Link from "next/link";import { useEffect } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";-import { useViewer } from "@/lib/api";+import { useHydrated, useViewer } from "@/lib/api";import { storageSize, timeAgo } from "@/lib/format";import { cn } from "@/lib/utils";import { responseError, toastError } from "@/lib/refusals";@@ -104,9 +104,11 @@ export function runsHref({ account, status, kind }: { account?: string; status?:/** Settings' strip (the owner): how many accounts, 0 included, and the way down to Accounts, the last section. */export function AccountsChip() {+ // Nothing until hydrated, as in the server's HTML, even when the answers are already in the cache.+ const hydrated = useHydrated();const owner = useViewer().data?.owner;const q = useAdminAccounts(!!owner);- if (!q.data) return null;+ if (!hydrated || !owner || !q.data) return null;return (<a href="#accounts" className="inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full bg-secondary px-2.5 text-[12px] whitespace-nowrap transition-colors hover:bg-accent"><span className="text-muted-foreground">Accounts</span>@@ -143,11 +145,12 @@ function useAccountsAnchor(ready: boolean) {/** Settings → Accounts (the owner only): who signed up (public sign-up), what each made and the space it takes, with switch-off, delete and a CSV export. */export function AccountsAdmin() {+ const hydrated = useHydrated();const owner = useViewer().data?.owner;const q = useAdminAccounts(!!owner);const act = useAdminAction();useAccountsAnchor(!!q.data);- if (!owner || (!q.data && !q.isError)) return null;+ if (!hydrated || !owner || (!q.data && !q.isError)) return null;const total = q.data?.total ?? 0;return (<section id="accounts" aria-labelledby="accounts-title" className="grid scroll-mt-28 grid-cols-[minmax(0,1fr)] gap-6 border-t py-8 md:scroll-mt-20 md:grid-cols-[260px_minmax(0,1fr)]">diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsxindex 9c2418d9..a7516a8f 100644--- a/src/components/app-sidebar.tsx+++ b/src/components/app-sidebar.tsx@@ -469,12 +469,16 @@ function YourGpuChip({ viewer }: { viewer: NonNullable<StatusInfo["viewer"]> })/*** Who is signed in (public sign-up): an account's email, with Settings, Your GPU and Sign out. Nothing- * for the owner or a guest. In the rail it's the initial alone; on a phone the menu opens upward.+ * for the owner or a guest. In the rail it's the initial alone; on a phone the menu opens upward. Until hydrated it is+ * the server's HTML (no row), even when the viewer query has already answered; until the viewer is known, a browser an+ * account used last keeps the row's height, so the footer doesn't move when it comes.*/function AccountRow() {- const account = useViewer().data?.account;+ const hydrated = useHydrated();+ const viewer = useViewer().data;+ const account = hydrated ? viewer?.account : undefined;const { isMobile } = useSidebar();- if (!account) return null;+ if (!account) return hydrated && viewer ? null : <div aria-hidden className="hidden h-9 group-data-[collapsible=icon]:h-8 [html[data-viewer='account']_&]:block" />;return (<SidebarMenu><SidebarMenuItem>diff --git a/src/components/gpu/account-gpu-section.tsx b/src/components/gpu/account-gpu-section.tsxindex 93431bb6..6840c78d 100644--- a/src/components/gpu/account-gpu-section.tsx+++ b/src/components/gpu/account-gpu-section.tsx@@ -3,12 +3,16 @@import { LogOut } from "lucide-react";import { ConnectChoice } from "@/components/gpu/connect-choice";import { Button } from "@/components/ui/button";-import { useViewer } from "@/lib/api";+import { useHydrated, useViewer } from "@/lib/api";-/** Settings for an account (public sign-up): "Your GPU", at the top of the page, and signing out. Nothing for the owner or a guest. */+/**+ * Settings for an account (public sign-up): "Your GPU", at the top of the page, and signing out. Nothing for the owner+ * or a guest, and nothing until hydrated: the server's HTML has none.+ */export function AccountGpuSection() {+ const hydrated = useHydrated();const account = useViewer().data?.account;- if (!account) return null;+ if (!hydrated || !account) return null;return (<section id="your-gpu" aria-labelledby="your-gpu-title" className="grid scroll-mt-28 grid-cols-[minmax(0,1fr)] gap-6 border-b py-8 md:scroll-mt-20 md:grid-cols-[260px_minmax(0,1fr)]"><div className="min-w-0">diff --git a/src/components/keys/your-keys.tsx b/src/components/keys/your-keys.tsxindex aa793100..5576391f 100644--- a/src/components/keys/your-keys.tsx+++ b/src/components/keys/your-keys.tsx@@ -9,7 +9,7 @@ import { Button } from "@/components/ui/button";import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle } from "@/components/ui/dialog";import { Input } from "@/components/ui/input";import { Label } from "@/components/ui/label";-import { ADD_KEY_EVENT, preferEngine, useStatus, useViewer } from "@/lib/api";+import { ADD_KEY_EVENT, preferEngine, useHydrated, useStatus, useViewer } from "@/lib/api";import { settingProblem } from "@/lib/connections";import { CLOUD_KEY, CLOUD_PROVIDERS, OPEN_ONLY_MESSAGE, type CloudProvider, type KeyInfo, type YourKeys } from "@/lib/your-keys";import { cn } from "@/lib/utils";@@ -271,9 +271,11 @@ function KeyCard({ provider, info }: { provider: CloudProvider; info: KeyInfo |/** Settings → Your keys, for accounts (below Your GPU). `prices`: what the studios' paid defaults cost (starterPriceLine). */export function AccountKeysSection({ prices }: { prices?: string }) {+ // Nothing until hydrated, as in the server's HTML, even when the viewer query has already answered.+ const hydrated = useHydrated();const account = useViewer().data?.account;const q = useYourKeys(!!account);- if (!account) return null;+ if (!hydrated || !account) return null;return (<section id="your-keys" aria-labelledby="your-keys-title" className="grid scroll-mt-28 grid-cols-[minmax(0,1fr)] gap-6 border-b py-8 md:scroll-mt-20 md:grid-cols-[260px_minmax(0,1fr)]"><div className="min-w-0">