Apply graph force layout on maxIterations change
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="./logo.png" />
|
<link rel="icon" type="image/svg+xml" href="./logo.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Lightrag</title>
|
<title>Lightrag</title>
|
||||||
<script type="module" crossorigin src="./assets/index-DvqywpUr.js"></script>
|
<script type="module" crossorigin src="./assets/index-CJz72b6Q.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-CH-3l4_Z.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-CH-3l4_Z.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@@ -40,18 +40,21 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
|
|||||||
const focusedEdge = useGraphStore.use.focusedEdge()
|
const focusedEdge = useGraphStore.use.focusedEdge()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When component mount
|
* When component mount or maxIterations changes
|
||||||
* => load the graph
|
* => load the graph and apply layout
|
||||||
*/
|
*/
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Create & load the graph
|
// Create & load the graph
|
||||||
const graph = lightrageGraph()
|
const graph = lightrageGraph()
|
||||||
loadGraph(graph)
|
loadGraph(graph)
|
||||||
if (!(graph as any).__force_applied) {
|
|
||||||
assignLayout()
|
assignLayout()
|
||||||
Object.assign(graph, { __force_applied: true })
|
}, [assignLayout, loadGraph, lightrageGraph, maxIterations])
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When component mount
|
||||||
|
* => register events
|
||||||
|
*/
|
||||||
|
useEffect(() => {
|
||||||
const { setFocusedNode, setSelectedNode, setFocusedEdge, setSelectedEdge, clearSelection } =
|
const { setFocusedNode, setSelectedNode, setFocusedEdge, setSelectedEdge, clearSelection } =
|
||||||
useGraphStore.getState()
|
useGraphStore.getState()
|
||||||
|
|
||||||
@@ -87,7 +90,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
|
|||||||
},
|
},
|
||||||
clickStage: () => clearSelection()
|
clickStage: () => clearSelection()
|
||||||
})
|
})
|
||||||
}, [assignLayout, loadGraph, registerEvents, lightrageGraph])
|
}, [registerEvents])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When component mount or hovered node change
|
* When component mount or hovered node change
|
||||||
|
Reference in New Issue
Block a user