* fix(ts): use strict mode strictNullChecks etc

* chore: Use extended React.HTMLAttributes<> (#41)

* refactor(code-format): add prettier closes #42

* feat(renderer): add snap to grid option closes #20

* chore(dependabot): use develop as target branch
This commit is contained in:
Moritz
2019-10-21 20:58:28 +02:00
committed by GitHub
parent ce210eb5dc
commit a793f8c2ff
80 changed files with 2634 additions and 1247 deletions
+6 -7
View File
@@ -9,7 +9,7 @@ const useElementUpdater = (elements: Elements): void => {
const state = useStoreState(s => ({
nodes: s.nodes,
edges: s.edges,
transform: s.transform
transform: s.transform,
}));
const setNodes = useStoreActions(a => a.setNodes);
@@ -19,16 +19,17 @@ const useElementUpdater = (elements: Elements): void => {
const nodes = elements.filter(isNode) as Node[];
const edges = elements.filter(isEdge).map(e => parseElement(e)) as Edge[];
const nextNodes = nodes.map((propNode) => {
const nextNodes = nodes.map(propNode => {
const existingNode = state.nodes.find(n => n.id === propNode.id);
if (existingNode) {
const data = !isEqual(existingNode.data, propNode.data) ?
{ ...existingNode.data, ...propNode.data } : existingNode.data;
const data = !isEqual(existingNode.data, propNode.data)
? { ...existingNode.data, ...propNode.data }
: existingNode.data;
return {
...existingNode,
data
data,
};
}
@@ -46,8 +47,6 @@ const useElementUpdater = (elements: Elements): void => {
setEdges(edges);
}
});
return null;
};
export default useElementUpdater;