diff --git a/app/components/ForceGraph.tsx b/app/components/ForceGraph.tsx index 3064e2c5..f66b9f49 100644 --- a/app/components/ForceGraph.tsx +++ b/app/components/ForceGraph.tsx @@ -223,13 +223,11 @@ export default function ForceGraph({ || hoverElement && ("source" in hoverElement) && hoverElement.id === link.id) || (selectedElements.length > 0 && selectedElements.some(el => el.id === link.id && !("source" in el))) ? 2 : 1} nodeCanvasObject={(node, ctx) => { - if (graph.Elements.nodes.length === 1) { + if (!node.x || !node.y) { node.x = 0 node.y = 0 } - if (node.x === undefined || node.y === undefined) return - ctx.lineWidth = ((selectedElement && !("source" in selectedElement) && selectedElement.id === node.id) || (hoverElement && !("source" in hoverElement) && hoverElement.id === node.id) || (selectedElements.length > 0 && selectedElements.some(el => el.id === node.id && !("source" in el)))) ? 1 : 0.5 @@ -272,7 +270,13 @@ export default function ForceGraph({ const start = link.source; const end = link.target; - if (!start.x || !start.y || !end.x || !end.y) return + if (!start.x || !start.y || !end.x || !end.y) { + start.x = 0 + start.y = 0 + end.x = 0 + end.y = 0 + } + let textX; let textY; diff --git a/app/schema/SchemaCreateElement.tsx b/app/schema/SchemaCreateElement.tsx index c61177fa..ceb9b386 100644 --- a/app/schema/SchemaCreateElement.tsx +++ b/app/schema/SchemaCreateElement.tsx @@ -124,7 +124,7 @@ export default function SchemaCreateElement({ onCreate, onExpand, selectedNodes, description: "You must type a label", variant: "destructive" }) - + return } @@ -134,17 +134,17 @@ export default function SchemaCreateElement({ onCreate, onExpand, selectedNodes, description: "You must select two nodes to create a relation", variant: "destructive" }) - + return } } - + try { setIsLoading(true) const ok = await onCreate(attributes, label) - + if (!ok) return - + setAttributes([]) setAttribute(getDefaultAttribute()) setLabel([]) @@ -205,17 +205,19 @@ export default function SchemaCreateElement({ onCreate, onExpand, selectedNodes,