Skip to content

Commit

Permalink
Merge pull request #349 from prathameshjchavan/fix/array-doesnt-update
Browse files Browse the repository at this point in the history
Fixed array length doesn't update
  • Loading branch information
AykutSarac authored Aug 18, 2023
2 parents 1fbb777 + 0050474 commit 282dfe5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/Graph/CustomNode/TextNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,11 @@ const Node: React.FC<CustomNodeProps> = ({ node, x, y, hasCollapse = false }) =>
};

function propsAreEqual(prev: CustomNodeProps, next: CustomNodeProps) {
return prev.node.text === next.node.text && prev.node.width === next.node.width;
return (
prev.node.text === next.node.text &&
prev.node.width === next.node.width &&
prev.node.data.childrenCount === next.node.data.childrenCount
);
}

export const TextNode = React.memo(Node, propsAreEqual);

0 comments on commit 282dfe5

Please sign in to comment.