loops wizard: fix client-bundle break from topology import
ci / gates (push) Successful in 7s
ci / frontend (push) Successful in 4m3s
ci / rust (push) Successful in 7m3s
ci / e2e (push) Has been skipped
ci / publish (push) Successful in 4m46s

@/lib/api/topology's apiFetch pulls in bearer.ts which imports
@clerk/nextjs/server — the whole chain gets tagged as client-side
by Next when LoopsWizard imports it, and 'server-only' breaks the
production build. Switch to plain fetch(/api/topologies) with
type-only imports (mirrors what TeamWizard does). Local pnpm build
now compiles clean; typecheck/lint already pass. This unblocks the
publish job on the topology-builder push.
This commit is contained in:
Omar Sobh
2026-07-06 13:03:24 -07:00
parent e5820ce927
commit 18a99a970d
@@ -16,11 +16,10 @@ import {
type LoopCreated, type LoopCreated,
type LoopRepeatPolicy, type LoopRepeatPolicy,
} from "@/lib/api/loops"; } from "@/lib/api/loops";
import { // Type-only imports — pulling the value exports from @/lib/api/topology drags
fetchTopologyCatalog, // bearer.ts + @clerk/nextjs/server into the client bundle and breaks the
type CatalogEntry, // production build. Call /api/topologies with plain fetch instead.
type TopologyGraph, import type { CatalogEntry, TopologyGraph } from "@/lib/api/topology";
} from "@/lib/api/topology";
const mono = const mono =
"ui-monospace, SFMono-Regular, SF Mono, Menlo, Monaco, Consolas, monospace"; "ui-monospace, SFMono-Regular, SF Mono, Menlo, Monaco, Consolas, monospace";
@@ -63,15 +62,23 @@ export function LoopsWizard({
const [created, setCreated] = useState<LoopCreated | null>(null); const [created, setCreated] = useState<LoopCreated | null>(null);
useEffect(() => { useEffect(() => {
void (async () => { let cancelled = false;
async function load() {
try { try {
const c = await fetchTopologyCatalog(); const r = await fetch("/api/topologies");
if (!r.ok) return;
const c = (await r.json()) as CatalogEntry[];
if (cancelled) return;
setCatalog(c); setCatalog(c);
if (c.length > 0) setKind((k) => k || c[0].kind); if (c.length > 0) setKind((k) => k || c[0].kind);
} catch { } catch {
// Catalog is optional — advanced mode still works. // Catalog is optional — advanced mode still works.
} }
})(); }
void load();
return () => {
cancelled = true;
};
}, []); }, []);
const selectedEntry = useMemo( const selectedEntry = useMemo(