Skip to content

Commit

Permalink
fix(rg): destruct props
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Aug 19, 2019
1 parent df216aa commit 3c9b152
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
14 changes: 8 additions & 6 deletions dist/ReactGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -33884,18 +33884,20 @@
onElementClick = _ref.onElementClick,
elements = _ref.elements,
children = _ref.children,
nodeTypes = _ref.nodeTypes,
edgeTypes = _ref.edgeTypes,
onLoad = _ref.onLoad,
onMove = _ref.onMove,
onElementsRemove = _ref.onElementsRemove,
onConnect = _ref.onConnect,
onNodeDragStop = _ref.onNodeDragStop,
connectionLineType = _ref.connectionLineType,
connectionLineStyle = _ref.connectionLineStyle;
var nodeTypes = React.useMemo(function () {
return createNodeTypes(props.nodeTypes);
var nodeTypesParsed = React.useMemo(function () {
return createNodeTypes(nodeTypes);
}, []);
var edgeTypes = React.useMemo(function () {
return createEdgeTypes(props.edgeTypes);
var edgeTypesParsed = React.useMemo(function () {
return createEdgeTypes(edgeTypes);
}, []);
return React__default.createElement("div", {
style: style,
Expand All @@ -33907,8 +33909,8 @@
onMove: onMove,
onElementClick: onElementClick,
onNodeDragStop: onNodeDragStop,
nodeTypes: nodeTypes,
edgeTypes: edgeTypes,
nodeTypes: nodeTypesParsed,
edgeTypes: edgeTypesParsed,
connectionLineType: connectionLineType,
connectionLineStyle: connectionLineStyle,
onConnect: onConnect
Expand Down
12 changes: 6 additions & 6 deletions src/ReactGraph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ import '../style.css';

const ReactGraph = ({
style, onElementClick, elements, children,
onLoad, onMove, onElementsRemove, onConnect,
onNodeDragStop, connectionLineType, connectionLineStyle
nodeTypes, edgeTypes, onLoad, onMove, onElementsRemove,
onConnect, onNodeDragStop, connectionLineType, connectionLineStyle
}) => {
const nodeTypes = useMemo(() => createNodeTypes(props.nodeTypes), []);
const edgeTypes = useMemo(() => createEdgeTypes(props.edgeTypes), []);
const nodeTypesParsed = useMemo(() => createNodeTypes(nodeTypes), []);
const edgeTypesParsed = useMemo(() => createEdgeTypes(edgeTypes), []);

return (
<div style={style} className="react-graph">
Expand All @@ -37,8 +37,8 @@ const ReactGraph = ({
onMove={onMove}
onElementClick={onElementClick}
onNodeDragStop={onNodeDragStop}
nodeTypes={nodeTypes}
edgeTypes={edgeTypes}
nodeTypes={nodeTypesParsed}
edgeTypes={edgeTypesParsed}
connectionLineType={connectionLineType}
connectionLineStyle={connectionLineStyle}
onConnect={onConnect}
Expand Down

0 comments on commit 3c9b152

Please sign in to comment.