diff --git a/modules/rnetwork/components/folk-graph-viewer.ts b/modules/rnetwork/components/folk-graph-viewer.ts index fc1b4fe..b3860ec 100644 --- a/modules/rnetwork/components/folk-graph-viewer.ts +++ b/modules/rnetwork/components/folk-graph-viewer.ts @@ -545,6 +545,13 @@ class FolkGraphViewer extends HTMLElement { const ForceGraph3D = (window as any).ForceGraph3D; if (!ForceGraph3D) throw new Error("ForceGraph3D not loaded — check UMD script tag"); + // Pre-load THREE so nodeThreeObject callback is synchronous. + // Import from the same module the UMD build uses internally + // to avoid "not an instance of THREE.Object3D" errors. + const THREE = await import("three"); + this._threeModule = THREE; + (window as any).__THREE_CACHE__ = THREE; + const graph = ForceGraph3D({ controlType: "orbit" })(container) .backgroundColor("rgba(0,0,0,0)") .showNavInfo(false)