@@ -392,6 +392,23 @@ function checkForGraphElementsChanges(nextProps, currentState) {
392392 return { graphElementsUpdated, newGraphElements } ;
393393}
394394
395+ /**
396+ * Logic to check for changes in graph config.
397+ * @param {Object } nextProps - nextProps that graph will receive.
398+ * @param {Object } currentState - the current state of the graph.
399+ * @returns {Object.<string, boolean> } returns object containing update check flags:
400+ * - configUpdated - global flag that indicates if any property was updated.
401+ * - d3ConfigUpdated - specific flag that indicates changes in d3 configurations.
402+ */
403+ function checkForGraphConfigChanges ( nextProps , currentState ) {
404+ const newConfig = nextProps . config || { } ;
405+ const configUpdated =
406+ newConfig && ! utils . isObjectEmpty ( newConfig ) && ! utils . isDeepEqual ( newConfig , currentState . config ) ;
407+ const d3ConfigUpdated = newConfig && newConfig . d3 && ! utils . isDeepEqual ( newConfig . d3 , currentState . config . d3 ) ;
408+
409+ return { configUpdated, d3ConfigUpdated } ;
410+ }
411+
395412/**
396413 * Encapsulates common procedures to initialize graph.
397414 * @param {Object } props - Graph component props, object that holds data, id and config.
@@ -579,9 +596,9 @@ function getNodeCardinality(nodeId, linksMatrix) {
579596}
580597
581598export {
582- NODE_PROPS_WHITELIST ,
583599 buildLinkProps ,
584600 buildNodeProps ,
601+ checkForGraphConfigChanges ,
585602 checkForGraphElementsChanges ,
586603 disconnectLeafNodeConnections ,
587604 getLeafNodeConnections ,
0 commit comments