footprint-explainable-ui 0.7.4 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -709,7 +709,7 @@ var DEFAULT_COLORS = {
709
709
  var Y_STEP = 100;
710
710
  var X_SPREAD = 200;
711
711
  function nid(n) {
712
- return n.name || n.id || `spec-${Math.random()}`;
712
+ return n.id || n.name || `spec-${Math.random()}`;
713
713
  }
714
714
  function registerNode(state, node) {
715
715
  if (node.id && node.name) {
@@ -945,10 +945,16 @@ function TracedFlowchartView({
945
945
  if (!spec) return null;
946
946
  return specToLayout(spec);
947
947
  }, [spec]);
948
- const { nodes, edges } = (0, import_react7.useMemo)(() => {
948
+ const flowData = (0, import_react7.useMemo)(() => {
949
949
  if (!layout) return { nodes: [], edges: [] };
950
950
  return applyOverlay(layout, overlay);
951
951
  }, [layout, overlay]);
952
+ const [nodes, setNodes, onNodesChange] = (0, import_react8.useNodesState)(flowData.nodes);
953
+ const [edges, setEdges, onEdgesChange] = (0, import_react8.useEdgesState)(flowData.edges);
954
+ (0, import_react7.useEffect)(() => {
955
+ setNodes(flowData.nodes);
956
+ setEdges(flowData.edges);
957
+ }, [flowData, setNodes, setEdges]);
952
958
  const handleNodeClick = (0, import_react7.useCallback)(
953
959
  (_, node) => {
954
960
  if (!onNodeClick) return;
@@ -967,6 +973,8 @@ function TracedFlowchartView({
967
973
  {
968
974
  nodes,
969
975
  edges,
976
+ onNodesChange,
977
+ onEdgesChange,
970
978
  onNodeClick: handleNodeClick,
971
979
  nodeTypes: nodeTypes2,
972
980
  fitView: true,