yangdx commited on
Commit
1f583de
·
1 Parent(s): 698fa1b

Remove unused codes

Browse files
lightrag_webui/src/hooks/useLightragGraph.tsx CHANGED
@@ -225,7 +225,6 @@ const useLightrangeGraph = () => {
225
  if (rawGraph !== null || sigmaGraph !== null) {
226
  const state = useGraphStore.getState()
227
  state.reset()
228
- state.setGraphLabels(['*'])
229
  state.setGraphDataFetchAttempted(false)
230
  state.setLabelsFetchAttempted(false)
231
  }
@@ -285,24 +284,7 @@ const useLightrangeGraph = () => {
285
  state.setSigmaGraph(newSigmaGraph)
286
  state.setRawGraph(data)
287
 
288
- // Extract labels from current graph data
289
- if (data) {
290
- const labelSet = new Set<string>()
291
- for (const node of data.nodes) {
292
- if (node.labels && Array.isArray(node.labels)) {
293
- for (const label of node.labels) {
294
- if (label !== '*') { // filter out label "*"
295
- labelSet.add(label)
296
- }
297
- }
298
- }
299
- }
300
- // Put * on top of other labels
301
- const sortedLabels = Array.from(labelSet).sort()
302
- state.setGraphLabels(['*', ...sortedLabels])
303
- } else {
304
- state.setGraphLabels(['*'])
305
- }
306
 
307
  // Update flags
308
  dataLoadedRef.current = true
 
225
  if (rawGraph !== null || sigmaGraph !== null) {
226
  const state = useGraphStore.getState()
227
  state.reset()
 
228
  state.setGraphDataFetchAttempted(false)
229
  state.setLabelsFetchAttempted(false)
230
  }
 
284
  state.setSigmaGraph(newSigmaGraph)
285
  state.setRawGraph(data)
286
 
287
+ // No longer need to extract labels from graph data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
288
 
289
  // Update flags
290
  dataLoadedRef.current = true
lightrag_webui/src/stores/graph.ts CHANGED
@@ -66,7 +66,6 @@ interface GraphState {
66
 
67
  rawGraph: RawGraph | null
68
  sigmaGraph: DirectedGraph | null
69
- graphLabels: string[]
70
  allDatabaseLabels: string[]
71
 
72
  moveToSelectedNode: boolean
@@ -89,7 +88,6 @@ interface GraphState {
89
 
90
  setRawGraph: (rawGraph: RawGraph | null) => void
91
  setSigmaGraph: (sigmaGraph: DirectedGraph | null) => void
92
- setGraphLabels: (labels: string[]) => void
93
  setAllDatabaseLabels: (labels: string[]) => void
94
  fetchAllDatabaseLabels: () => Promise<void>
95
  setIsFetching: (isFetching: boolean) => void
@@ -116,7 +114,6 @@ const useGraphStoreBase = create<GraphState>()((set, get) => ({
116
 
117
  rawGraph: null,
118
  sigmaGraph: null,
119
- graphLabels: ['*'],
120
  allDatabaseLabels: ['*'],
121
 
122
  refreshLayout: () => {
@@ -161,7 +158,6 @@ const useGraphStoreBase = create<GraphState>()((set, get) => ({
161
  focusedEdge: null,
162
  rawGraph: null,
163
  // Keep the existing graph instance but with cleared data
164
- graphLabels: ['*'],
165
  moveToSelectedNode: false,
166
  shouldRender: false
167
  });
@@ -177,8 +173,6 @@ const useGraphStoreBase = create<GraphState>()((set, get) => ({
177
  set({ sigmaGraph });
178
  },
179
 
180
- setGraphLabels: (labels: string[]) => set({ graphLabels: labels }),
181
-
182
  setAllDatabaseLabels: (labels: string[]) => set({ allDatabaseLabels: labels }),
183
 
184
  fetchAllDatabaseLabels: async () => {
 
66
 
67
  rawGraph: RawGraph | null
68
  sigmaGraph: DirectedGraph | null
 
69
  allDatabaseLabels: string[]
70
 
71
  moveToSelectedNode: boolean
 
88
 
89
  setRawGraph: (rawGraph: RawGraph | null) => void
90
  setSigmaGraph: (sigmaGraph: DirectedGraph | null) => void
 
91
  setAllDatabaseLabels: (labels: string[]) => void
92
  fetchAllDatabaseLabels: () => Promise<void>
93
  setIsFetching: (isFetching: boolean) => void
 
114
 
115
  rawGraph: null,
116
  sigmaGraph: null,
 
117
  allDatabaseLabels: ['*'],
118
 
119
  refreshLayout: () => {
 
158
  focusedEdge: null,
159
  rawGraph: null,
160
  // Keep the existing graph instance but with cleared data
 
161
  moveToSelectedNode: false,
162
  shouldRender: false
163
  });
 
173
  set({ sigmaGraph });
174
  },
175
 
 
 
176
  setAllDatabaseLabels: (labels: string[]) => set({ allDatabaseLabels: labels }),
177
 
178
  fetchAllDatabaseLabels: async () => {