It looks like your issue might be related to stale state in your onAdd function. React’s state updates are asynchronous, which means newNodes might not contain the latest fetched data when you try to add them. I recently came across some great optimization techniques for React Flow projects that might help improve performance and state management—check out this guide: https://www.synergycodes.com/blog/guide-to-optimize-react-flow-project-performance