Skip to content

Commit ac8eed6

Browse files
committed
revert: roll back custom n8n build canvas (phases 1-3)
The custom React Flow canvas didn't hold up in real testing — generic monogram tiles instead of real n8n node icons broke the immersion, and the canvas → iframe handoff felt like a context switch rather than a seamless reveal. Better to use the real n8n UI throughout, even if the node-by-node build animation is harder to engineer. Reverts: - 6a6d27a feat(n8n-canvas): phase 3 — entry, edge-draw, and handoff animations - 387bbf9 feat(n8n-canvas): phase 2 — render the canonical workflow on a custom canvas - 87eac96 feat(n8n-canvas): phase 1 — emit workflowDraft and nodeExploring events Removes: N8nBuildCanvas component + CSS, n8nBuildState in chat-context, workflowDraft/nodeExploring event types, keepBuildCanvasMounted latch, workflow.json detector in e2b_write_file, get_node interception in n8nMcpToolsMiddleware, @xyflow/react dependency. Preserves all unrelated fixes from prior commits (path normalization, validate-loop break, summary filter, UUID requirement, token tracking, cold-start gate). Next step is a different approach: have the agent use n8n's REST API to mutate an existing workflow live, so users see real n8n nodes appearing one at a time in the actual n8n UI via its WebSocket-driven canvas updates.
1 parent 6a6d27a commit ac8eed6

9 files changed

Lines changed: 1 addition & 738 deletions

File tree

package-lock.json

Lines changed: 0 additions & 177 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
"@trpc/tanstack-react-query": "^11.4.3",
6666
"@types/http-proxy": "^1.17.17",
6767
"@vercel/speed-insights": "^2.0.0",
68-
"@xyflow/react": "^12.11.0",
6968
"class-variance-authority": "^0.7.1",
7069
"client-only": "^0.0.1",
7170
"clsx": "^2.1.1",

src/app/chat/[id]/page.tsx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { GithubButton } from "@/components/GithubButton";
1616
import { TemplateApprovalCard } from "@/components/TemplateApprovalCard";
1717
import { SandboxExpiredPanel } from "@/components/SandboxExpiredPanel";
1818
import { BackendWarmingBanner } from "@/components/BackendWarmingBanner";
19-
import { N8nBuildCanvas } from "@/components/N8nBuildCanvas";
2019
import { Users } from "lucide-react";
2120
import { useIsMobile } from "@/hooks/use-mobile";
2221
import { useAgentStream } from "@/hooks/use-agent-stream";
@@ -304,26 +303,6 @@ function ChatPage() {
304303
// from here instead of the e2b URL so the n8n auth cookie lands first-party
305304
// (browsers block third-party cookies in iframes even with SameSite=None).
306305
const [n8nClaimUrl, setN8nClaimUrl] = useState<string | null>(null);
307-
// Build-canvas hand-off latch: stays true while the n8n build canvas is
308-
// active (exploring/drafting) AND for ~400ms past the phase flip to
309-
// 'finalized', so the canvas can run its CSS fade-out before the iframe
310-
// takes over. Without this latch, the canvas unmounts the instant the
311-
// workflowReady event arrives and the user sees a hard cut to the iframe.
312-
const [keepBuildCanvasMounted, setKeepBuildCanvasMounted] = useState(false);
313-
useEffect(() => {
314-
const phase = ctx.n8nBuildState.phase;
315-
if (phase === "exploring" || phase === "drafting") {
316-
setKeepBuildCanvasMounted(true);
317-
return;
318-
}
319-
if (phase === "finalized" && keepBuildCanvasMounted) {
320-
// Already mounted — hold for the fade-out duration then unmount.
321-
const timer = setTimeout(() => setKeepBuildCanvasMounted(false), 400);
322-
return () => clearTimeout(timer);
323-
}
324-
// 'idle' or fresh-mount on 'finalized' — no canvas to keep.
325-
if (phase === "idle") setKeepBuildCanvasMounted(false);
326-
}, [ctx.n8nBuildState.phase, keepBuildCanvasMounted]);
327306

328307
// --- Refs for one-shot effects ---
329308
const didInitRef = useRef(false);
@@ -869,22 +848,6 @@ function ChatPage() {
869848
);
870849
}
871850

872-
// n8n build canvas — replaces the iframe while the agent is composing the
873-
// workflow. Snaps from placeholders (exploring) to a positioned canonical
874-
// graph (drafting) before handing off to the real n8n UI in the iframe
875-
// once `workflowReady` flips phase to `finalized`. The keepBuildCanvasMounted
876-
// latch holds the canvas in the DOM ~400ms past the phase flip so its
877-
// CSS fade-out can play before the iframe takes over.
878-
if (ctx.templateType === "n8n" && keepBuildCanvasMounted) {
879-
return (
880-
<N8nBuildCanvas
881-
phase={ctx.n8nBuildState.phase}
882-
exploredNodeTypes={ctx.n8nBuildState.exploredNodeTypes}
883-
draft={ctx.n8nBuildState.draft}
884-
/>
885-
);
886-
}
887-
888851
if (ctx.sandboxUrl && !ctx.isSandboxExpired) {
889852
return (
890853
<div className="relative w-full h-full flex flex-col bg-background">

src/components/N8nBuildCanvas.css

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)