diff --git a/src/components/Edges/CustomEdge.tsx b/src/components/Edges/CustomEdge.tsx index 3bdc47e..2946dcc 100644 --- a/src/components/Edges/CustomEdge.tsx +++ b/src/components/Edges/CustomEdge.tsx @@ -6,6 +6,7 @@ import { useInternalNode, } from '@xyflow/react'; import { useGraphStore } from '../../stores/graphStore'; +import { shallow } from 'zustand/shallow'; import type { Relation } from '../../types'; import LabelBadge from '../Common/LabelBadge'; import { getFloatingEdgeParams } from '../../utils/edgeUtils'; @@ -35,9 +36,9 @@ const CustomEdge = ({ data, selected, }: EdgeProps) => { - const edgeTypes = useGraphStore((state) => state.edgeTypes); - const labels = useGraphStore((state) => state.labels); - const nodeTypes = useGraphStore((state) => state.nodeTypes); + const edgeTypes = useGraphStore((state) => state.edgeTypes, shallow); + const labels = useGraphStore((state) => state.labels, shallow); + const nodeTypes = useGraphStore((state) => state.nodeTypes, shallow); // Get active filters based on mode (editing vs presentation) const filters = useActiveFilters(); diff --git a/src/components/Nodes/CustomNode.tsx b/src/components/Nodes/CustomNode.tsx index 4075a55..4ee56d2 100644 --- a/src/components/Nodes/CustomNode.tsx +++ b/src/components/Nodes/CustomNode.tsx @@ -1,6 +1,7 @@ import { memo, useMemo } from "react"; import { Handle, Position, NodeProps } from "@xyflow/react"; import { useGraphStore } from "../../stores/graphStore"; +import { shallow } from "zustand/shallow"; import { getContrastColor, adjustColorBrightness, @@ -26,8 +27,8 @@ import { * Usage: Automatically rendered by React Flow for nodes with type='custom' */ const CustomNode = ({ data, selected }: NodeProps) => { - const nodeTypes = useGraphStore((state) => state.nodeTypes); - const labels = useGraphStore((state) => state.labels); + const nodeTypes = useGraphStore((state) => state.nodeTypes, shallow); + const labels = useGraphStore((state) => state.labels, shallow); // Get active filters based on mode (editing vs presentation) const filters = useActiveFilters();