Skip to content

Commit

Permalink
refactor(onConnect): rename sourceId to source
Browse files Browse the repository at this point in the history
  • Loading branch information
moklick committed Jul 29, 2019
1 parent 8fb45f4 commit 939a1d5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions example/build/example.e31bb0bc.js
Original file line number Diff line number Diff line change
Expand Up @@ -41463,15 +41463,16 @@ var _default = function _default(NodeComponent) {

var onDrop = function onDrop(evt) {
evt.preventDefault();
var sourceId = evt.dataTransfer.getData('text/plain');
var source = evt.dataTransfer.getData('text/plain');

if (sourceId === id) {
if (source === id) {
console.warn('You can\'t connect a node with itself.');
return false;
}

onConnect({
sourceId: sourceId,
targetId: id
source: source,
target: id
});
};

Expand Down
2 changes: 1 addition & 1 deletion example/build/example.e31bb0bc.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions src/NodeRenderer/NodeTypes/wrapNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,14 @@ export default NodeComponent => memo((props) => {
const onDrop = (evt) => {
evt.preventDefault();

const sourceId = evt.dataTransfer.getData('text/plain');
const source = evt.dataTransfer.getData('text/plain');

if (sourceId === id) {
if (source === id) {
console.warn('You can\'t connect a node with itself.');
return false;
}

onConnect({ sourceId, targetId: id });
onConnect({ source, target: id });
};

return (
Expand Down

0 comments on commit 939a1d5

Please sign in to comment.