React Sigma graph search options do not refresh when graph is reloaded using useLoader hook
14:41 17 Dec 2025

I am using React Sigma to create graphs dynamically from a JSON object. I am using the loadGraph hook to the create the graph as described here: https://sim51.github.io/react-sigma/docs/example/load-graph#by-using-useloadgraph I am also using the GraphSearch feature described here: https://sim51.github.io/react-sigma/docs/example/graph-search The problem is that the nodes in my graph change dynamically based on a bunch of user parameters. However, the graph search index does not keep up and I keep getting the error could not find the "xyz" node in the graph. How can I update the index of the graph search manually when I update the nodes?

Here is a sample of the code I am using: MainComponent.tsx

const [nodes, setNodes] = useState([]);
const [edges, setEdges] = useState([]);

return (
  
    
      
    
    <
  
);

CVEGraph.tsx

useEffect(()=>{
  g = new MultiDirectedGraph();
  for (const node of nodes) {
    g.addNode(node.label, {x:node.x,y:node.y});
  }
  for (const edge of edges){
    g.addEdge(edge.x,edge.y);
  }
  loadgraph(g);
});
return null;
reactjs sigma.js