@neo4j-nvl/react 0.3.8-1b682ea4 → 0.3.8-77d65d80
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.
|
@@ -71,11 +71,24 @@ export const BasicNvlWrapper = memo(forwardRef(({ nodes, rels, layout, layoutOpt
|
|
|
71
71
|
const nodeChanges = getMapDifferences(currentNodes, nodes);
|
|
72
72
|
const nodeDiff = getNodeAttributeDifferences(currentNodes, nodes);
|
|
73
73
|
const relChanges = getMapDifferences(currentRels, rels);
|
|
74
|
+
const graphIsUnchanged = nodeChanges.added.length === 0 &&
|
|
75
|
+
nodeChanges.removed.length === 0 &&
|
|
76
|
+
nodeDiff.length === 0 &&
|
|
77
|
+
relChanges.added.length === 0 &&
|
|
78
|
+
relChanges.removed.length === 0 &&
|
|
79
|
+
relChanges.updated.length === 0;
|
|
80
|
+
if (graphIsUnchanged) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
74
83
|
setCurrentRels(rels);
|
|
75
84
|
setCurrentNodes(nodes);
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
nvlRef.current.
|
|
85
|
+
const nodesToAddAndUpdate = [...nodeChanges.added, ...nodeDiff];
|
|
86
|
+
const relsToAddAndUpdate = [...relChanges.added, ...relChanges.updated];
|
|
87
|
+
nvlRef.current.addAndUpdateElementsInGraph(nodesToAddAndUpdate, relsToAddAndUpdate);
|
|
88
|
+
const relationshipsToRemove = relChanges.removed.map((r) => r.id);
|
|
89
|
+
const nodesToRemove = nodeChanges.removed.map((n) => n.id);
|
|
90
|
+
nvlRef.current.removeRelationshipsWithIds(relationshipsToRemove);
|
|
91
|
+
nvlRef.current.removeNodesWithIds(nodesToRemove);
|
|
79
92
|
}, [currentNodes, currentRels, nodes, rels]);
|
|
80
93
|
useEffect(() => {
|
|
81
94
|
const updatedLayout = layout ?? nvlOptions.layout;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neo4j-nvl/react",
|
|
3
|
-
"version": "0.3.8-
|
|
3
|
+
"version": "0.3.8-77d65d80",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"homepage": "https://neo4j.com/docs/nvl/current/",
|
|
6
6
|
"license": "SEE LICENSE IN 'LICENSE.txt'",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"babel-eslint": "^10.1.0"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@neo4j-nvl/base": "0.3.8-
|
|
38
|
-
"@neo4j-nvl/interaction-handlers": "0.3.8-
|
|
37
|
+
"@neo4j-nvl/base": "0.3.8-77d65d80",
|
|
38
|
+
"@neo4j-nvl/interaction-handlers": "0.3.8-77d65d80",
|
|
39
39
|
"lodash": "4.17.21",
|
|
40
40
|
"react": "^18.2.0",
|
|
41
41
|
"react-dom": "^18.2.0"
|