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 LoopRepeatPolicy,
} from "@/lib/api/loops";
import {
fetchTopologyCatalog,
type CatalogEntry,
type TopologyGraph,
} from "@/lib/api/topology";
// Type-only imports — pulling the value exports from @/lib/api/topology drags
// bearer.ts + @clerk/nextjs/server into the client bundle and breaks the
// production build. Call /api/topologies with plain fetch instead.
import type { CatalogEntry, TopologyGraph } from "@/lib/api/topology";
const mono =
"ui-monospace, SFMono-Regular, SF Mono, Menlo, Monaco, Consolas, monospace";
@@ -63,15 +62,23 @@ export function LoopsWizard({
const [created, setCreated] = useState<LoopCreated | null>(null);
useEffect(() => {
void (async () => {
let cancelled = false;
async function load() {
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);
if (c.length > 0) setKind((k) => k || c[0].kind);
} catch {
// Catalog is optional — advanced mode still works.
}
})();
}
void load();
return () => {
cancelled = true;
};
}, []);
const selectedEntry = useMemo(