Optimize dependency arrays in graph components
- Add `t` to `GraphLabels` dependency array - Add `isFetching` to `useLightragGraph` dependencies
This commit is contained in:
@@ -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) => {
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user