prevProps: cloneDeep()

in src/SankeyDiagram.js [988:1075]


        prevProps: cloneDeep(nextProps),
      };
    }

    return null;
  }

  static makeSankeyGraph(props) {
    const innerWidth = props.width - (props.marginLeft + props.marginRight);
    const innerHeight = props.height - (props.marginTop + props.marginBottom);
    const makeSankey = sankey()
      .size([innerWidth, innerHeight])
      .nodeId(props.nodeId)
      .nodeWidth(props.nodeWidth)
      .nodePadding(props.nodePadding)
      .nodeSort(props.nodeSort)
      .linkSort(props.linkSort)
      .nodeAlign(
        nodeAlignmentsByName[props.nodeAlignment] ||
          nodeAlignmentsByName.justify,
      );

    const nodes = props.shouldClone ? cloneDeep(props.nodes) : props.nodes;
    const links = props.shouldClone ? cloneDeep(props.links) : props.links;
    const sankeyGraph = makeSankey({ nodes, links });
    return enhanceGraph(sankeyGraph);
  }

  constructor(props) {
    super(props);
    const graph = SankeyDiagram.makeSankeyGraph(props);
    const prevProps = cloneDeep(props);
    this.state = { graph, prevProps };
  }

  render() {
    const {
      width,
      height,
      style,
      standalone,
      nodeId,
      marginTop,
      marginBottom,
      marginLeft,
      marginRight,
    } = this.props;

    const { graph } = this.state;
    const makeLinkPath = sankeyLinkHorizontal();
    const className = `rct-sankey-diagram ${this.props.className}`;
    const innerWidth = width - (marginLeft + marginRight);
    const innerHeight = height - (marginTop + marginBottom);

    function mapNodesInGroupIf(shouldShow, groupClassName, mapFunc) {
      if (!shouldShow) return null;
      return (
        <g className={groupClassName}>
          {(graph.nodes || []).map((node, i) => {
            if (!getValue(shouldShow, node, graph)) return null;
            const key = `node-${nodeId(node)}`;
            return mapFunc(node, i, key);
          })}
        </g>
      );
    }

    function mapLinksInGroupIf(shouldShow, groupClassName, mapFunc) {
      if (!shouldShow) return null;
      return (
        <g className={groupClassName}>
          {(graph.links || []).map((link, i) => {
            if (!getValue(shouldShow, link, graph)) return null;
            const key = `link-${nodeId(link.source)}-to-${nodeId(link.target)}`;
            return mapFunc(link, i, key);
          })}
        </g>
      );
    }

    function displayStepLabelsIf(
      stepLabelText,
      stepLabelClassName,
      stepLabelStyle,
      stepLabelPadding,
      nodes,
    ) {
      if (!stepLabelText) {