From 0e234beaf540896239b1968dc59d34bc1cf1ec54 Mon Sep 17 00:00:00 2001 From: yangdx Date: Wed, 12 Mar 2025 05:44:27 +0800 Subject: [PATCH] Always fetch data for "*" label --- lightrag_webui/src/components/graph/GraphLabels.tsx | 2 +- lightrag_webui/src/hooks/useLightragGraph.tsx | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lightrag_webui/src/components/graph/GraphLabels.tsx b/lightrag_webui/src/components/graph/GraphLabels.tsx index a3849e1f..1e73eb38 100644 --- a/lightrag_webui/src/components/graph/GraphLabels.tsx +++ b/lightrag_webui/src/components/graph/GraphLabels.tsx @@ -64,7 +64,7 @@ const GraphLabels = () => { let result: string[] = labels if (query) { // Search labels - result = searchEngine.search(query).map((r) => labels[r.id]) + result = searchEngine.search(query).map((r: { id: number }) => labels[r.id]) } return result.length <= labelListLimit diff --git a/lightrag_webui/src/hooks/useLightragGraph.tsx b/lightrag_webui/src/hooks/useLightragGraph.tsx index 651047f6..1349e857 100644 --- a/lightrag_webui/src/hooks/useLightragGraph.tsx +++ b/lightrag_webui/src/hooks/useLightragGraph.tsx @@ -186,9 +186,14 @@ const useLightrangeGraph = () => { useEffect(() => { if (queryLabel) { - if (lastQueryLabel.label !== queryLabel || - lastQueryLabel.maxQueryDepth !== maxQueryDepth || - lastQueryLabel.minDegree !== minDegree) { + // Always fetch data for "*" label + // For other labels, only fetch when parameters change + const shouldUpdate = queryLabel === '*' || + lastQueryLabel.label !== queryLabel || + lastQueryLabel.maxQueryDepth !== maxQueryDepth || + lastQueryLabel.minDegree !== minDegree; + + if (shouldUpdate) { lastQueryLabel.label = queryLabel lastQueryLabel.maxQueryDepth = maxQueryDepth lastQueryLabel.minDegree = minDegree