Optimize dependency arrays in graph components
- Add `t` to `GraphLabels` dependency array - Add `isFetching` to `useLightragGraph` dependencies
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -8,7 +8,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-fJflQM9b.js"></script>
|
<script type="module" crossorigin src="./assets/index-Deh3-0KJ.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-DRGuXfZw.css">
|
<link rel="stylesheet" crossorigin href="./assets/index-DRGuXfZw.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@@ -49,7 +49,7 @@ const GraphLabels = () => {
|
|||||||
? result
|
? result
|
||||||
: [...result.slice(0, labelListLimit), t('graphLabels.andOthers', { count: result.length - labelListLimit })]
|
: [...result.slice(0, labelListLimit), t('graphLabels.andOthers', { count: result.length - labelListLimit })]
|
||||||
},
|
},
|
||||||
[getSearchEngine]
|
[getSearchEngine, t]
|
||||||
)
|
)
|
||||||
|
|
||||||
const setQueryLabel = useCallback((newLabel: string) => {
|
const setQueryLabel = useCallback((newLabel: string) => {
|
||||||
|
@@ -187,7 +187,7 @@ const useLightrangeGraph = () => {
|
|||||||
// Update previous parameters
|
// Update previous parameters
|
||||||
prevParamsRef.current = { queryLabel, maxQueryDepth, minDegree };
|
prevParamsRef.current = { queryLabel, maxQueryDepth, minDegree };
|
||||||
}
|
}
|
||||||
}, [queryLabel, maxQueryDepth, minDegree])
|
}, [queryLabel, maxQueryDepth, minDegree, isFetching])
|
||||||
|
|
||||||
const getNode = useCallback(
|
const getNode = useCallback(
|
||||||
(nodeId: string) => {
|
(nodeId: string) => {
|
||||||
@@ -258,7 +258,7 @@ const useLightrangeGraph = () => {
|
|||||||
state.reset()
|
state.reset()
|
||||||
state.setSigmaGraph(new DirectedGraph())
|
state.setSigmaGraph(new DirectedGraph())
|
||||||
}
|
}
|
||||||
}, [queryLabel, maxQueryDepth, minDegree])
|
}, [queryLabel, maxQueryDepth, minDegree, isFetching])
|
||||||
|
|
||||||
const lightrageGraph = useCallback(() => {
|
const lightrageGraph = useCallback(() => {
|
||||||
if (sigmaGraph) {
|
if (sigmaGraph) {
|
||||||
|
Reference in New Issue
Block a user