yangdx
commited on
Commit
·
c4124e7
1
Parent(s):
df1342a
Apply graph force layout on maxIterations change
Browse files
lightrag/api/webui/assets/{index-DvqywpUr.js → index-CJz72b6Q.js}
RENAMED
Binary files a/lightrag/api/webui/assets/index-DvqywpUr.js and b/lightrag/api/webui/assets/index-CJz72b6Q.js differ
|
|
lightrag/api/webui/index.html
CHANGED
Binary files a/lightrag/api/webui/index.html and b/lightrag/api/webui/index.html differ
|
|
lightrag_webui/src/components/graph/GraphControl.tsx
CHANGED
@@ -40,18 +40,21 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
|
|
40 |
const focusedEdge = useGraphStore.use.focusedEdge()
|
41 |
|
42 |
/**
|
43 |
-
* When component mount
|
44 |
-
* => load the graph
|
45 |
*/
|
46 |
useEffect(() => {
|
47 |
// Create & load the graph
|
48 |
const graph = lightrageGraph()
|
49 |
loadGraph(graph)
|
50 |
-
|
51 |
-
|
52 |
-
Object.assign(graph, { __force_applied: true })
|
53 |
-
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
55 |
const { setFocusedNode, setSelectedNode, setFocusedEdge, setSelectedEdge, clearSelection } =
|
56 |
useGraphStore.getState()
|
57 |
|
@@ -87,7 +90,7 @@ const GraphControl = ({ disableHoverEffect }: { disableHoverEffect?: boolean })
|
|
87 |
},
|
88 |
clickStage: () => clearSelection()
|
89 |
})
|
90 |
-
}, [
|
91 |
|
92 |
/**
|
93 |
* When component mount or hovered node change
|
|
|
40 |
const focusedEdge = useGraphStore.use.focusedEdge()
|
41 |
|
42 |
/**
|
43 |
+
* When component mount or maxIterations changes
|
44 |
+
* => load the graph and apply layout
|
45 |
*/
|
46 |
useEffect(() => {
|
47 |
// Create & load the graph
|
48 |
const graph = lightrageGraph()
|
49 |
loadGraph(graph)
|
50 |
+
assignLayout()
|
51 |
+
}, [assignLayout, loadGraph, lightrageGraph, maxIterations])
|
|
|
|
|
52 |
|
53 |
+
/**
|
54 |
+
* When component mount
|
55 |
+
* => register events
|
56 |
+
*/
|
57 |
+
useEffect(() => {
|
58 |
const { setFocusedNode, setSelectedNode, setFocusedEdge, setSelectedEdge, clearSelection } =
|
59 |
useGraphStore.getState()
|
60 |
|
|
|
90 |
},
|
91 |
clickStage: () => clearSelection()
|
92 |
})
|
93 |
+
}, [registerEvents])
|
94 |
|
95 |
/**
|
96 |
* When component mount or hovered node change
|