yangdx commited on
Commit
dd22942
·
1 Parent(s): 5a328de

Fix Graph TAB flickering issue in node expansion

Browse files
lightrag_webui/src/hooks/useLightragGraph.tsx CHANGED
@@ -339,14 +339,10 @@ const useLightrangeGraph = () => {
339
  if (!nodeId || !sigmaGraph || !rawGraph) return;
340
 
341
  try {
342
- // Set fetching state
343
- useGraphStore.getState().setIsFetching(true);
344
-
345
  // Get the node to expand
346
  const nodeToExpand = rawGraph.getNode(nodeId);
347
  if (!nodeToExpand) {
348
  console.error('Node not found:', nodeId);
349
- useGraphStore.getState().setIsFetching(false);
350
  return;
351
  }
352
 
@@ -354,7 +350,6 @@ const useLightrangeGraph = () => {
354
  const label = nodeToExpand.labels[0];
355
  if (!label) {
356
  console.error('Node has no label:', nodeId);
357
- useGraphStore.getState().setIsFetching(false);
358
  return;
359
  }
360
 
@@ -363,7 +358,6 @@ const useLightrangeGraph = () => {
363
 
364
  if (!extendedGraph || !extendedGraph.nodes || !extendedGraph.edges) {
365
  console.error('Failed to fetch extended graph');
366
- useGraphStore.getState().setIsFetching(false);
367
  return;
368
  }
369
 
@@ -439,7 +433,6 @@ const useLightrangeGraph = () => {
439
  // If no new connectable nodes found, show toast and return
440
  if (nodesToAdd.size === 0) {
441
  toast.info(t('graphPanel.propertiesView.node.noNewNodes'));
442
- useGraphStore.getState().setIsFetching(false);
443
  return;
444
  }
445
 
@@ -610,9 +603,6 @@ const useLightrangeGraph = () => {
610
 
611
  } catch (error) {
612
  console.error('Error expanding node:', error);
613
- } finally {
614
- // Reset fetching state
615
- useGraphStore.getState().setIsFetching(false);
616
  }
617
  };
618
 
 
339
  if (!nodeId || !sigmaGraph || !rawGraph) return;
340
 
341
  try {
 
 
 
342
  // Get the node to expand
343
  const nodeToExpand = rawGraph.getNode(nodeId);
344
  if (!nodeToExpand) {
345
  console.error('Node not found:', nodeId);
 
346
  return;
347
  }
348
 
 
350
  const label = nodeToExpand.labels[0];
351
  if (!label) {
352
  console.error('Node has no label:', nodeId);
 
353
  return;
354
  }
355
 
 
358
 
359
  if (!extendedGraph || !extendedGraph.nodes || !extendedGraph.edges) {
360
  console.error('Failed to fetch extended graph');
 
361
  return;
362
  }
363
 
 
433
  // If no new connectable nodes found, show toast and return
434
  if (nodesToAdd.size === 0) {
435
  toast.info(t('graphPanel.propertiesView.node.noNewNodes'));
 
436
  return;
437
  }
438
 
 
603
 
604
  } catch (error) {
605
  console.error('Error expanding node:', error);
 
 
 
606
  }
607
  };
608