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
Layout shifts: late rows keep their place, skeletons take the shape that's coming
Claudea090a2af7302
diff --git a/src/components/assist-view.tsx b/src/components/assist-view.tsxindex 83c829fb..b746e26d 100644--- a/src/components/assist-view.tsx+++ b/src/components/assist-view.tsx@@ -6,6 +6,7 @@ import { useRouter, useSearchParams } from "next/navigation";import { useEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";import { Button } from "@/components/ui/button";+import { Skeleton } from "@/components/ui/skeleton";import { SidebarTrigger } from "@/components/ui/sidebar";import { Switch } from "@/components/ui/switch";import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";@@ -43,7 +44,7 @@ export function AskFirst({ checked, onChange }: { checked: boolean; onChange: (vreturn (<Tooltip><TooltipTrigger asChild>- <label className="inline-flex h-9 shrink-0 cursor-pointer items-center gap-2 rounded-full px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground hover:bg-accent hover:text-foreground">+ <label className="inline-flex h-9 shrink-0 cursor-pointer items-center gap-2 rounded-full px-2.5 text-[13px] font-medium whitespace-nowrap text-muted-foreground hover:bg-accent hover:text-foreground max-sm:gap-1.5 max-sm:px-1.5"><Switch size="sm" checked={checked} onCheckedChange={onChange} aria-label="Ask before generating" />Ask first</label>@@ -81,7 +82,7 @@ export function NewChatControls({return (<><ModePicker value={choice} onChange={setChoice} availability={can} />- <EngineSwitch value={engine} onChange={setEngine} size="sm" />+ <EngineSwitch value={engine} onChange={setEngine} size="sm" compact /><AskFirst checked={askFirst} onChange={setAskFirst} /></>);@@ -189,7 +190,7 @@ export function AssistView() {onSend={start}footer={<NewChatControls choice={choice} setChoice={setChoice} can={can} engine={engine} setEngine={setEngine} askFirst={askFirst} setAskFirst={setAskFirst} />}/>- <SkillStarters skills={available} onPick={(s) => setDraft((d) => ({ key: d.key + 1, text: `/${s.name} ` }))} />+ <SkillStarters skills={available} loading={skills.data === undefined && !skills.isError} onPick={(s) => setDraft((d) => ({ key: d.key + 1, text: `/${s.name} ` }))} /><div className="mt-6 flex flex-wrap justify-center gap-2">{SUGGESTIONS.map((s) => (<button@@ -263,8 +264,36 @@ export function AssistView() {}/** One-tap skill starters under the empty composer: picking one types `/name ` into it. */-export function SkillStarters({ skills, onPick, className }: { skills: SkillSummary[]; onPick: (s: SkillSummary) => void; className?: string }) {+/**+ * The starter cards under the composer. While the skills load (`loading`) the six cards are drawn+ * as same-sized placeholders, so the suggestions below don't jump down when they arrive.+ */+export function SkillStarters({ skills, loading, onPick, className }: { skills: SkillSummary[]; loading?: boolean; onPick: (s: SkillSummary) => void; className?: string }) {const shown = [...STARTER_SKILLS.map((n) => skills.find((s) => s.name === n)).filter((s): s is SkillSummary => !!s), ...skills.filter((s) => !STARTER_SKILLS.includes(s.name))].slice(0, 6);+ if (loading && !shown.length) {+ return (+ <div className={cn("mt-4", className)} aria-busy="true" aria-label="Loading skills">+ <div className="flex items-center justify-between px-1 pb-2">+ <p className="text-[12px] font-medium text-muted-foreground">Start with a skill</p>+ </div>+ <div className="grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3">+ {STARTER_SKILLS.map((n) => (+ <div key={n} aria-hidden className="flex min-w-0 items-center gap-3 rounded-xl border bg-background p-2.5">+ <Skeleton className="size-9 shrink-0 rounded-lg" />+ <span className="min-w-0 flex-1">+ <span className="flex h-[1lh] items-center text-[13px]">+ <Skeleton className="h-3 w-1/2" />+ </span>+ <span className="flex h-[1lh] items-center text-[12px]">+ <Skeleton className="h-2.5 w-4/5" />+ </span>+ </span>+ </div>+ ))}+ </div>+ </div>+ );+ }if (!shown.length) return null;return (<div className={cn("mt-4", className)}>diff --git a/src/components/assist/composer.tsx b/src/components/assist/composer.tsxindex 82fd8668..7db143d8 100644--- a/src/components/assist/composer.tsx+++ b/src/components/assist/composer.tsx@@ -12,6 +12,7 @@ import { uploadFile } from "@/lib/api";import { insertSlash, pickSlash, slashQuery, slashSkills, type SkillSummary } from "@/lib/assist";import type { MediaKind } from "@/lib/catalog/types";import { cn } from "@/lib/utils";+import { useEdgeFade } from "@/components/studio/use-edge-fade";import { SkillIcon } from "./skill-icon";interface Attachment {@@ -52,6 +53,7 @@ export function AssistComposer({const input = useRef<HTMLInputElement>(null);const area = useRef<HTMLTextAreaElement>(null);const box = useRef<HTMLDivElement>(null);+ const [chipRow, fade] = useEdgeFade<HTMLDivElement>();const listId = useId();const uploading = files.some((f) => !f.url);const ready = text.trim().length > 0 && !uploading && !sending && !disabled;@@ -271,18 +273,17 @@ export function AssistComposer({rows={1}placeholder={placeholder}aria-label="Message"- role={skills?.length ? "combobox" : undefined}- aria-expanded={skills?.length ? menuOpen : undefined}+ // A textarea can't be a combobox (axe aria-allowed-role): it stays a text box that names the open skills list and its active row.aria-controls={menuOpen ? listId : undefined}aria-activedescendant={menuOpen ? `${listId}-${matches[active]?.name}` : undefined}aria-autocomplete={skills?.length ? "list" : undefined}className="field-sizing-content max-h-56 min-h-12 w-full resize-none bg-transparent px-2 py-1.5 text-base leading-relaxed outline-none placeholder:text-subtle-foreground"/>- <div className="mt-1 flex min-w-0 flex-wrap items-center gap-1.5">+ <div className="mt-1 flex min-w-0 items-center gap-1.5"><input ref={input} type="file" accept="image/*,video/*,audio/*" multiple hidden onChange={(e) => (add(e.target.files), (e.target.value = ""))} /><Tooltip><TooltipTrigger asChild>- <button type="button" onClick={() => input.current?.click()} className="grid size-9 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground" aria-label="Attach files">+ <button type="button" onClick={() => input.current?.click()} className="grid size-9 shrink-0 place-items-center rounded-full text-muted-foreground hover:bg-accent hover:text-foreground max-sm:size-8" aria-label="Attach files"><Paperclip className="size-4" /></button></TooltipTrigger>@@ -310,8 +311,11 @@ export function AssistComposer({</TooltipContent></Tooltip>)}- {footer}- <Button size="icon" className="ml-auto size-10 shrink-0 rounded-full" disabled={!ready} onClick={() => void send()} aria-label="Send">+ {/* Phones: the chips are one row that scrolls (faded at the edge), so the composer keeps its height and Send stays put. */}+ <div ref={chipRow} style={fade} className="scrollbar-none -my-1 flex min-w-0 flex-1 items-center gap-1 overflow-x-auto py-1 sm:flex-wrap sm:gap-1.5 sm:overflow-visible">+ {footer}+ </div>+ <Button size="icon" className="size-10 shrink-0 rounded-full" disabled={!ready} onClick={() => void send()} aria-label="Send">{sending ? <Loader2 className="animate-spin" /> : <ArrowUp />}</Button></div>diff --git a/src/components/assist/mode-picker.tsx b/src/components/assist/mode-picker.tsxindex 3393a425..4fa1477e 100644--- a/src/components/assist/mode-picker.tsx+++ b/src/components/assist/mode-picker.tsx@@ -160,12 +160,14 @@ export function ModePicker({<buttontype="button"disabled={disabled}- className="inline-flex h-8 max-w-[11rem] shrink-0 items-center gap-1.5 rounded-full bg-secondary px-3 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent disabled:opacity-50"+ // One width for "Smart", "Free" and "Mode": the label can change once availability loads, and the chips after it must not move.+ // Phones drop the chevron, so the composer's chips fit one row at 390 px.+ className="inline-flex h-8 max-w-[11rem] min-w-[6.5rem] shrink-0 items-center justify-center gap-1.5 rounded-full bg-secondary px-3 text-[13px] font-medium text-secondary-foreground transition-colors hover:bg-accent disabled:opacity-50 max-sm:min-w-[5rem] max-sm:px-2.5"aria-label={`Mode: ${label}`}><Icon className="size-3.5 shrink-0" /><span className="truncate">{label}</span>- <ChevronDown className="size-3 shrink-0 opacity-60" />+ <ChevronDown className="size-3 shrink-0 opacity-60 max-sm:hidden" /></button></PopoverTrigger><PopoverContent align="start" collisionPadding={12} className="w-[min(92vw,360px)] p-3">diff --git a/src/components/assist/project-view.tsx b/src/components/assist/project-view.tsxindex 98afbd63..7dd20842 100644--- a/src/components/assist/project-view.tsx+++ b/src/components/assist/project-view.tsx@@ -136,7 +136,7 @@ function Project({ p }: { p: AssistProject }) {}}footer={<NewChatControls choice={choice} setChoice={setChoice} can={can} engine={engine} setEngine={setEngine} askFirst={askFirst} setAskFirst={setAskFirst} />}/>- {!chats.data?.threads.length && <SkillStarters skills={available} onPick={(s) => setDraft((d) => ({ key: d.key + 1, text: `/${s.name} ` }))} />}+ {!chats.data?.threads.length && <SkillStarters skills={available} loading={skills.data === undefined && !skills.isError} onPick={(s) => setDraft((d) => ({ key: d.key + 1, text: `/${s.name} ` }))} />}</div></div><Tabs value={tab} onValueChange={setTab} className="mt-10 gap-4">diff --git a/src/components/cinema/projects-view.tsx b/src/components/cinema/projects-view.tsxindex 55faebb3..5c86c870 100644--- a/src/components/cinema/projects-view.tsx+++ b/src/components/cinema/projects-view.tsx@@ -6,6 +6,7 @@ import { useRouter } from "next/navigation";import { useState } from "react";import { PageShell } from "@/components/page-shell";import { PageHeader } from "@/components/page-shell";+import { HadItemsScript, useHadItems } from "@/components/use-had-items";import { Button } from "@/components/ui/button";import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/ui/dropdown-menu";import { Skeleton } from "@/components/ui/skeleton";@@ -100,11 +101,50 @@ function ProjectCard({ project, onSettings }: { project: CinemaProject; onSettin);}+const GRID = "grid grid-cols-1 gap-x-5 gap-y-7 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4";++/**+ * The first-production block, or (`loading`) a placeholder of exactly its size: a grid skeleton+ * swapped for this block moved the page (CLS 0.048 in the round-4 audit).+ */+function EmptyProjects({ loading, onCreate, className }: { loading?: boolean; onCreate: () => void; className?: string }) {+ return (+ <div className={cn("mx-auto flex max-w-md flex-col items-center pt-[8vh] text-center", className)} aria-busy={loading || undefined} aria-label={loading ? "Loading projects" : undefined}>+ {loading ? (+ <>+ <Skeleton className="size-14 rounded-2xl" />+ <span className="mt-5 flex h-[1lh] w-full items-center justify-center font-heading text-[26px] leading-tight">+ <Skeleton className="h-6 w-2/3" />+ </span>+ {/* Two lines of 15 px text, then the button's 36 px. */}+ <span className="mt-2 flex h-[2lh] w-full flex-col items-center justify-center gap-2 text-[15px]">+ <Skeleton className="h-3.5 w-full" />+ <Skeleton className="h-3.5 w-1/2" />+ </span>+ <Skeleton className="mt-6 h-9 w-36 rounded-full" />+ </>+ ) : (+ <>+ <div className="grid size-14 place-items-center rounded-2xl bg-brand-faint text-brand-text">+ <Clapperboard className="size-6" />+ </div>+ <h2 className="mt-5 font-heading text-[26px] leading-tight">Start your first production</h2>+ <p className="mt-2 text-[15px] text-muted-foreground">Projects keep your generations, elements, and chats together – create one to start.</p>+ <Button className="mt-6" onClick={onCreate}>+ <Plus /> New project+ </Button>+ </>+ )}+ </div>+ );+}+export function CinemaProjects() {const { data, isLoading } = useCinemaProjects();const router = useRouter();const [creating, setCreating] = useState(false);const [editing, setEditing] = useState<CinemaProject | null>(null);+ useHadItems("cinema-projects", data?.length);return (<PageShell wide><PageHeader title="Cinema Studio" description="Direct films shot by shot: genre, camera, lens, palette and light, with characters and locations that stay the same.">@@ -113,28 +153,24 @@ export function CinemaProjects() {</Button></PageHeader>{isLoading ? (- <div className="grid grid-cols-1 gap-x-5 gap-y-7 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">- {Array.from({ length: 4 }, (_, i) => (- <div key={i}>- <Skeleton className="aspect-video rounded-xl" />- <Skeleton className="mt-3 h-4 w-2/3" />- <Skeleton className="mt-2 h-3 w-1/3" />- </div>- ))}- </div>- ) : !data?.length ? (- <div className="mx-auto flex max-w-md flex-col items-center pt-[8vh] text-center">- <div className="grid size-14 place-items-center rounded-2xl bg-brand-faint text-brand-text">- <Clapperboard className="size-6" />+ // Both shapes are in the server's shell; the one this browser saw last time shows from the first paint.+ <div key="loading">+ <HadItemsScript name="cinema-projects" />+ <div className={cn(GRID, "hidden [html[data-had-cinema-projects='1']_&]:grid")} aria-busy="true" aria-label="Loading projects">+ {Array.from({ length: 4 }, (_, i) => (+ <div key={i}>+ <Skeleton className="aspect-video rounded-xl" />+ <Skeleton className="mt-3 h-4 w-2/3" />+ <Skeleton className="mt-2 h-3 w-1/3" />+ </div>+ ))}</div>- <h2 className="mt-5 font-heading text-[26px] leading-tight">Start your first production</h2>- <p className="mt-2 text-[15px] text-muted-foreground">Projects keep your generations, elements, and chats together – create one to start.</p>- <Button className="mt-6" onClick={() => setCreating(true)}>- <Plus /> New project- </Button>+ <EmptyProjects loading className="[html[data-had-cinema-projects='1']_&]:hidden" onCreate={() => setCreating(true)} /></div>+ ) : !data?.length ? (+ <EmptyProjects key="empty" onCreate={() => setCreating(true)} />) : (- <div className="grid grid-cols-1 gap-x-5 gap-y-7 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4">+ <div key="cards" className={GRID}>{data.map((p) => (<ProjectCard key={p.id} project={p} onSettings={() => setEditing(p)} />))}diff --git a/src/components/home-view.tsx b/src/components/home-view.tsxindex e966b709..f71989e7 100644--- a/src/components/home-view.tsx+++ b/src/components/home-view.tsx@@ -21,6 +21,8 @@ import {import { useRouter } from "next/navigation";import { lazy, Suspense, useState } from "react";import { PageShell } from "@/components/page-shell";+import { Skeleton } from "@/components/ui/skeleton";+import { HadItemsScript, useHadItems } from "@/components/use-had-items";import { CardPending, IntentLink } from "@/components/intent-link";import { PresetCard } from "@/components/preset-gallery";import { MediaThumb } from "@/components/studio/result-media";@@ -113,9 +115,9 @@ function RecentStrip({ items }: { items: Generation[] }) {);}-function Row({ title, href, children }: { title: string; href: string; children: React.ReactNode }) {+function Row({ title, href, children, className }: { title: string; href: string; children: React.ReactNode; className?: string }) {return (- <section className="space-y-3">+ <section className={cn("space-y-3", className)}><div className="flex items-center justify-between"><h2 className="font-heading text-[24px]">{title}</h2><Link href={href} className="inline-flex items-center gap-1 text-[13px] text-muted-foreground hover:text-foreground">@@ -143,6 +145,7 @@ export function HomeView({ counts, motions, apps, effects }: { counts: Counts; mconst [prompt, setPrompt] = useState("");const [engine, setEngine, engineMode] = useEngine();const recent = useGenerations({ limit: 6 });+ useHadItems("home-recent", recent.data?.length);// The page hydrates inside the route's Suspense boundary, possibly after the sidebar already fetched// the status: render the server's (status-less) view until hydrated, as useEngineMode does.const hydrated = useHydrated();@@ -239,10 +242,24 @@ export function HomeView({ counts, motions, apps, effects }: { counts: Counts; m</div><div className="mt-14 space-y-12">- {!!recent.data?.length && (+ {recent.data?.length ? (<Row title="Recent" href="/library"><RecentStrip items={recent.data.slice(0, 6)} /></Row>+ ) : (+ // Loading, in a browser that saw results here last time: the row keeps its place from the first paint, so the rows below don't move down when it arrives.+ !recent.data && (+ <>+ <HadItemsScript name="home-recent" />+ <Row title="Recent" href="/library" className="hidden [html[data-had-home-recent='1']_&]:block">+ <div className="grid grid-cols-3 gap-2 sm:grid-cols-6" aria-busy="true" aria-label="Loading recent results">+ {Array.from({ length: 6 }, (_, i) => (+ <Skeleton key={i} className="aspect-square rounded-xl" />+ ))}+ </div>+ </Row>+ </>+ ))}<Row title="Camera motions" href="/motions"><CardRow cards={motions} href={(p) => `/video?preset=${p.id}`} engine={locked} />diff --git a/src/components/library-view.tsx b/src/components/library-view.tsxindex 745c9f6a..6525f875 100644--- a/src/components/library-view.tsx+++ b/src/components/library-view.tsx@@ -3,7 +3,7 @@import { ArchiveRestore, CheckSquare, ChevronUp, CircleDot, Download, FolderInput, Heart, Loader2, Pin, PinOff, Search, Trash2, X } from "lucide-react";import Link from "next/link";import { usePathname, useRouter, useSearchParams } from "next/navigation";-import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";+import { Suspense, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";import { toast } from "sonner";import { AssetCard, cardRatio, type CardApi } from "@/components/library/asset-card";import { FilterBar, filterFields, filtersFor, hasFilters, NO_FILTERS, type Filters } from "@/components/library/filters";@@ -143,9 +143,11 @@ const GAP = 8;function Masonry({ entries, size, render }: { entries: LibraryEntry[]; size: number; render: (e: LibraryEntry) => React.ReactNode }) {const ref = useRef<HTMLDivElement>(null);const [width, setWidth] = useState(0);- useEffect(() => {+ // Measured before the first paint: a guessed column count, corrected a frame later, moved every card (CLS 0.42 on a phone).+ useLayoutEffect(() => {const el = ref.current;if (!el) return;+ setWidth(Math.round(el.getBoundingClientRect().width));const ro = new ResizeObserver(([e]) => setWidth(Math.round(e.contentRect.width)));ro.observe(el);return () => ro.disconnect();@@ -563,7 +565,7 @@ function Inner() {>{t.label}{n ? (- <span className="font-mono text-[11px] text-muted-foreground" aria-label={`${n} items`}>+ <span className="min-w-4 font-mono text-[11px] text-muted-foreground tabular-nums" aria-label={`${n} items`}>{n}</span>) : null}@@ -573,9 +575,19 @@ function Inner() {</div>)}- {(tab.id === "all" && !folderId && (folders.data?.length || !loading)) || (folder && !trash) ? (+ {/* The folder row has its place from the first paint: arriving later, it pushed the filters and the cards down. */}+ {(tab.id === "all" && !folderId) || (folder && !trash) ? (<div className="mb-4">- <FolderStrip all={allFolders} parent={folder ?? null} steps={filters.steps} onOpen={(f) => go({ folder: f.id })} onMove={(list, f) => void moveTo(list, f.id, f.name)} />+ {folders.data ? (+ <FolderStrip all={allFolders} parent={folder ?? null} steps={filters.steps} onOpen={(f) => go({ folder: f.id })} onMove={(list, f) => void moveTo(list, f.id, f.name)} />+ ) : (+ <div className="-mx-1 flex gap-2 overflow-hidden px-1 py-1" aria-busy="true" aria-label="Loading folders">+ <div className="flex w-[min(44vw,160px)] shrink-0 items-center gap-2.5 rounded-xl border border-dashed p-2">+ <Skeleton className="size-11 shrink-0 rounded-lg" />+ <Skeleton className="h-3 w-16" />+ </div>+ </div>+ )}</div>) : null}diff --git a/src/components/studio/engine-switch.tsx b/src/components/studio/engine-switch.tsxindex e7327c56..5b09a221 100644--- a/src/components/studio/engine-switch.tsx+++ b/src/components/studio/engine-switch.tsx@@ -15,21 +15,22 @@ const OPTIONS: { value: Engine; label: string; icon: typeof Cloud; tip: string }/*** Segmented control with a sliding white thumb (Liner-style). `md` (page headers) turns- * icon-only below the sm breakpoint so titles keep their line on phones; the tooltips and- * aria labels still name each engine.+ * icon-only below the sm breakpoint so titles keep their line on phones (`compact` does the same+ * for `sm`, e.g. in Assist's one-row footer); the tooltips and aria labels still name each engine.*/export function EngineSwitch({value,onChange,size = "md",+ compact = size === "md",}: {value: Engine;onChange: (e: Engine) => void;size?: "sm" | "md";+ compact?: boolean;}) {const mode = useEngineMode();const idx = OPTIONS.findIndex((o) => o.value === value);- const compact = size === "md";if (mode !== "both") {const o = OPTIONS.find((x) => x.value === mode)!;const text = mode === "open" ? "Open source only" : "Cloud only";diff --git a/src/components/use-had-items.ts b/src/components/use-had-items.tsnew file mode 100644index 00000000..a7aed60e--- /dev/null+++ b/src/components/use-had-items.ts@@ -0,0 +1,54 @@+"use client";++import { createElement, useEffect, useLayoutEffect } from "react";++/*+ * Whether a list was non-empty the last time this browser loaded it, so its loading state can take+ * the shape that's coming (a row of skeletons, or the empty state) instead of a guess swapped for+ * something of another height. The answer lives in localStorage and, for CSS, in a `data-had-<name>`+ * attribute on <html>, set before the first paint by <HadItemsScript> (the server's shell renders+ * both shapes; a class like `[html[data-had-home-recent='1']_&]:block` picks one). A browser that has+ * never loaded the list gets the "empty" shape.+ */++const storageKey = (name: string) => `fuobe:had:${name}`;+const attr = (name: string) => `data-had-${name}`;++function apply(name: string, had: boolean) {+ if (had) document.documentElement.setAttribute(attr(name), "1");+ else document.documentElement.removeAttribute(attr(name));+}++/** The pre-paint script's text (exported for tests). */+export function hadItemsScript(name: string): string {+ return `(function(){try{if(localStorage.getItem(${JSON.stringify(storageKey(name))})==="1")document.documentElement.setAttribute(${JSON.stringify(attr(name))},"1")}catch(e){}})()`;+}++/**+ * Runs while the HTML is parsed, so the remembered shape shows from the first paint. On the client it+ * renders as inert text/plain (React warns about executable scripts it renders itself), like the+ * sidebar's state script; useHadItems covers pages opened by client-side navigation.+ */+export function HadItemsScript({ name }: { name: string }) {+ return createElement("script", {+ type: typeof window === "undefined" ? "text/javascript" : "text/plain",+ suppressHydrationWarning: true,+ dangerouslySetInnerHTML: { __html: hadItemsScript(name) },+ });+}++/** Remember whether the list (`count`, undefined while it loads) had anything, and keep <html>'s attribute in step. */+export function useHadItems(name: string, count: number | undefined) {+ useLayoutEffect(() => {+ try {+ apply(name, localStorage.getItem(storageKey(name)) === "1");+ } catch {}+ }, [name]);+ useEffect(() => {+ if (count === undefined) return;+ try {+ localStorage.setItem(storageKey(name), count ? "1" : "0");+ } catch {}+ apply(name, count > 0);+ }, [name, count]);+}diff --git a/tests/e2e/assist-flows.mjs b/tests/e2e/assist-flows.mjsindex 68ef93f6..43308ae9 100644--- a/tests/e2e/assist-flows.mjs+++ b/tests/e2e/assist-flows.mjs@@ -88,7 +88,7 @@ page.on("pageerror", (e) => errors.push(e.message));await step("skill menu, chip and a chat with the skill loaded", async () => {await openRoute(page, `${app}/assist`);- const box = page.getByRole("combobox", { name: "Message" });+ const box = page.getByRole("textbox", { name: "Message" });await box.click();await box.type("/prod");await page.getByRole("option", { name: /Product Photographer/ }).waitFor({ timeout: 10_000 });@@ -108,7 +108,7 @@ await step("skill menu, chip and a chat with the skill loaded", async () => {await step("remember asks first, then shows on the Memory page", async () => {await openRoute(page, `${app}/assist`);- const box = page.getByRole("combobox", { name: "Message" });+ const box = page.getByRole("textbox", { name: "Message" });await box.fill("Remember that I always want vertical 9:16 videos");await box.press("Enter");await page.getByText("Remember this?").waitFor({ timeout: 30_000 });@@ -135,7 +135,7 @@ await step("a project with instructions and a note; its chats carry it", async (await page.getByRole("button", { name: "Add note" }).click();await page.getByText("Brand voice").first().waitFor({ timeout: 10_000 });await shot(page, "flow-project");- const box = page.getByRole("combobox", { name: "Message" });+ const box = page.getByRole("textbox", { name: "Message" });await box.fill("Three sneaker stills on pastel backdrops");await box.press("Enter");await page.waitForURL(/\/assist\?c=/, { timeout: 20_000 });