Optimize dependency arrays in graph components

- Add `t` to `GraphLabels` dependency array
- Add `isFetching` to `useLightragGraph` dependencies
This commit is contained in:
yangdx
2025-03-12 19:06:47 +08:00
parent 35ea9e3720
commit 8388647bf6
4 changed files with 5 additions and 5 deletions

View File

@@ -8,7 +8,7 @@
<link rel="icon" type="image/svg+xml" href="./logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<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">
</head>
<body>

View File

@@ -49,7 +49,7 @@ const GraphLabels = () => {
? result
: [...result.slice(0, labelListLimit), t('graphLabels.andOthers', { count: result.length - labelListLimit })]
},
[getSearchEngine]
[getSearchEngine, t]
)
const setQueryLabel = useCallback((newLabel: string) => {

View File

@@ -187,7 +187,7 @@ const useLightrangeGraph = () => {
// Update previous parameters
prevParamsRef.current = { queryLabel, maxQueryDepth, minDegree };
}
}, [queryLabel, maxQueryDepth, minDegree])
}, [queryLabel, maxQueryDepth, minDegree, isFetching])
const getNode = useCallback(
(nodeId: string) => {
@@ -258,7 +258,7 @@ const useLightrangeGraph = () => {
state.reset()
state.setSigmaGraph(new DirectedGraph())
}
}, [queryLabel, maxQueryDepth, minDegree])
}, [queryLabel, maxQueryDepth, minDegree, isFetching])
const lightrageGraph = useCallback(() => {
if (sigmaGraph) {