{"size": 609, "ext": "js", "max_stars_repo_path": "src/logics/actionHelper.js", "max_stars_repo_name": "Stepwisepl/gremlin-visualizer", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/logics/actionHelper.js", "max_issues_repo_name": "Stepwisepl/gremlin-visualizer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/logics/actionHelper.js", "max_forks_repo_name": "Stepwisepl/gremlin-visualizer", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.0526315789, "max_line_length": 99, "alphanum_fraction": 0.7257799672}
import { extractEdgesAndNodes } from './utils';
import {optionActions, graphActions} from '../slices';


export const onFetchQuery = (result, query, oldNodeLabels, dispatch) => {

  const { nodes, edges, nodeLabels } = extractEdgesAndNodes(result.data, oldNodeLabels);

  const newNodes = nodes.map(node => {
    return { ...node, properties: { age: node.properties.age[0], name: node.properties.name[0]  } }
  })



  dispatch(graphActions.addNodes(newNodes));
  dispatch(graphActions.addEdges(edges));
  dispatch(optionActions.addQueryHistory(query));
  dispatch(optionActions.setNodeLabels(nodeLabels));
};