AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): Fix issue when pasting blocks (#9443)
Krzysztof Czerwinskia5ad90f09b0e
diff --git a/autogpt_platform/frontend/src/hooks/useCopyPaste.ts b/autogpt_platform/frontend/src/hooks/useCopyPaste.tsindex 10498d429c..19b3e094bc 100644--- a/autogpt_platform/frontend/src/hooks/useCopyPaste.ts+++ b/autogpt_platform/frontend/src/hooks/useCopyPaste.ts@@ -101,28 +101,26 @@ export function useCopyPaste(getNextNodeId: () => string) {setNodes((nodes) => {return nodes.map((node) => {- if (oldToNewIdMap[node.id]) {- const nodeConnections = pastedEdges- .filter(- (edge: Edge) =>- edge.source === node.id || edge.target === node.id,- )- .map((edge: Edge) => ({- edge_id: edge.id,- source: edge.source,- target: edge.target,- sourceHandle: edge.sourceHandle,- targetHandle: edge.targetHandle,- }));- return {- ...node,- data: {- ...node.data,- connections: nodeConnections,- },- };- }- return node;+ const nodeConnections = getEdges()+ .filter(+ (edge: Edge) =>+ edge.source === node.id || edge.target === node.id,+ )+ .map((edge: Edge) => ({+ edge_id: edge.id,+ source: edge.source,+ target: edge.target,+ sourceHandle: edge.sourceHandle,+ targetHandle: edge.targetHandle,+ }));++ return {+ ...node,+ data: {+ ...node.data,+ connections: nodeConnections,+ },+ };});});}