From 063ad8a35a466276187ddcfc1493c4f979ba56d1 Mon Sep 17 00:00:00 2001 From: yangdx Date: Fri, 14 Mar 2025 04:25:45 +0800 Subject: [PATCH] Remove unused codes --- lightrag_webui/src/hooks/useLightragGraph.tsx | 20 +------------------ lightrag_webui/src/stores/graph.ts | 6 ------ 2 files changed, 1 insertion(+), 25 deletions(-) diff --git a/lightrag_webui/src/hooks/useLightragGraph.tsx b/lightrag_webui/src/hooks/useLightragGraph.tsx index b5c9042a..efed5bac 100644 --- a/lightrag_webui/src/hooks/useLightragGraph.tsx +++ b/lightrag_webui/src/hooks/useLightragGraph.tsx @@ -225,7 +225,6 @@ const useLightrangeGraph = () => { if (rawGraph !== null || sigmaGraph !== null) { const state = useGraphStore.getState() state.reset() - state.setGraphLabels(['*']) state.setGraphDataFetchAttempted(false) state.setLabelsFetchAttempted(false) } @@ -285,24 +284,7 @@ const useLightrangeGraph = () => { state.setSigmaGraph(newSigmaGraph) state.setRawGraph(data) - // Extract labels from current graph data - if (data) { - const labelSet = new Set() - for (const node of data.nodes) { - if (node.labels && Array.isArray(node.labels)) { - for (const label of node.labels) { - if (label !== '*') { // filter out label "*" - labelSet.add(label) - } - } - } - } - // Put * on top of other labels - const sortedLabels = Array.from(labelSet).sort() - state.setGraphLabels(['*', ...sortedLabels]) - } else { - state.setGraphLabels(['*']) - } + // No longer need to extract labels from graph data // Update flags dataLoadedRef.current = true diff --git a/lightrag_webui/src/stores/graph.ts b/lightrag_webui/src/stores/graph.ts index 2c082064..f04c8a0c 100644 --- a/lightrag_webui/src/stores/graph.ts +++ b/lightrag_webui/src/stores/graph.ts @@ -66,7 +66,6 @@ interface GraphState { rawGraph: RawGraph | null sigmaGraph: DirectedGraph | null - graphLabels: string[] allDatabaseLabels: string[] moveToSelectedNode: boolean @@ -89,7 +88,6 @@ interface GraphState { setRawGraph: (rawGraph: RawGraph | null) => void setSigmaGraph: (sigmaGraph: DirectedGraph | null) => void - setGraphLabels: (labels: string[]) => void setAllDatabaseLabels: (labels: string[]) => void fetchAllDatabaseLabels: () => Promise setIsFetching: (isFetching: boolean) => void @@ -116,7 +114,6 @@ const useGraphStoreBase = create()((set, get) => ({ rawGraph: null, sigmaGraph: null, - graphLabels: ['*'], allDatabaseLabels: ['*'], refreshLayout: () => { @@ -161,7 +158,6 @@ const useGraphStoreBase = create()((set, get) => ({ focusedEdge: null, rawGraph: null, // Keep the existing graph instance but with cleared data - graphLabels: ['*'], moveToSelectedNode: false, shouldRender: false }); @@ -177,8 +173,6 @@ const useGraphStoreBase = create()((set, get) => ({ set({ sigmaGraph }); }, - setGraphLabels: (labels: string[]) => set({ graphLabels: labels }), - setAllDatabaseLabels: (labels: string[]) => set({ allDatabaseLabels: labels }), fetchAllDatabaseLabels: async () => {