Skip to content

Self-hosted MCP server + dashboard giving Claude Code, Cursor & Hermes agents shared long-term memory over a git-backed markdown vault. Agent-native, Obsidian-compatible second brain — markdown RAG, no vector DB.

fix(graph): crash when panning ("can't access property x, pan.current is null")

Ronalds Palacis7a085ecbdd7a
diff --git a/app/(app)/graph/error.tsx b/app/(app)/graph/error.tsx
new file mode 100644
index 0000000..bef1e6c
--- /dev/null
+++ b/app/(app)/graph/error.tsx
@@ -0,0 +1,22 @@
+"use client";
+
+import { useEffect } from "react";
+
+/** Scopes graph-render errors to this segment so a crash here doesn't blank the whole app. */
+export default function GraphError({ error, reset }: { error: Error & { digest?: string }; reset: () => void }) {
+ useEffect(() => {
+ console.error("[graph] render error", error);
+ }, [error]);
+
+ return (
+ <div className="flex h-full flex-col items-center justify-center gap-3 px-6 text-center">
+ <p className="text-sm text-muted-foreground">The graph hit a snag rendering.</p>
+ <button
+ onClick={reset}
+ className="rounded-md border border-border px-3 py-1.5 text-sm text-foreground transition-colors hover:bg-accent"
+ >
+ Reload graph
+ </button>
+ </div>
+ );
+}
diff --git a/components/graph-view.tsx b/components/graph-view.tsx
index 6f5ff62..aa2f64a 100644
--- a/components/graph-view.tsx
+++ b/components/graph-view.tsx
@@ -124,7 +124,11 @@ export function GraphView() {
simRef.current?.alphaTarget(0.3).restart();
}
} else if (pan.current?.active) {
- setView((v) => ({ ...v, x: e.clientX - pan.current!.x, y: e.clientY - pan.current!.y }));
+ // Capture now — the setView updater runs later (batched), by which point a
+ // pointerup may have nulled pan.current (crash: "can't access property x").
+ const px = pan.current.x;
+ const py = pan.current.y;
+ setView((v) => ({ ...v, x: e.clientX - px, y: e.clientY - py }));
}
}}
onPointerUp={() => {