changed useFlow declaration from destructuring to selector to improve performance

This commit is contained in:
Lucas Oliveira 2024-01-05 11:49:07 -03:00
commit 503e7766ba
12 changed files with 49 additions and 27 deletions

View file

@ -72,7 +72,10 @@ export default function ParameterComponent({
const updateNodeInternals = useUpdateNodeInternals();
const [position, setPosition] = useState(0);
const { tabId, flows } = useContext(FlowsContext);
const { nodes, edges, setNode } = useFlow();
const nodes = useFlow((state) => state.nodes);
const edges = useFlow((state) => state.edges);
const setNode = useFlow((state) => state.setNode);
const flow = flows.find((flow) => flow.id === tabId)?.data?.nodes ?? null;