Skip to content

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.

feat(frontend): Add delete key bindings to ReactFlow editor (#11693)

Abhimanyu Yadavb87c64ce38fb
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/Flow.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/Flow.tsx
index 4c6796d746..cf6dd1885c 100644
--- a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/Flow.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/Flow/Flow.tsx
@@ -99,6 +99,7 @@ export const Flow = () => {
nodesDraggable={!isLocked}
nodesConnectable={!isLocked}
elementsSelectable={!isLocked}
+ deleteKeyCode={["Backspace", "Delete"]}
>
<Background />
<CustomControls setIsLocked={setIsLocked} isLocked={isLocked} />
diff --git a/autogpt_platform/frontend/src/app/(platform)/build/stores/edgeStore.ts b/autogpt_platform/frontend/src/app/(platform)/build/stores/edgeStore.ts
index 0d0e4202fb..cae1d995da 100644
--- a/autogpt_platform/frontend/src/app/(platform)/build/stores/edgeStore.ts
+++ b/autogpt_platform/frontend/src/app/(platform)/build/stores/edgeStore.ts
@@ -115,10 +115,11 @@ export const useEdgeStore = create<EdgeStore>((set, get) => ({
edge.data?.beadData ??
new Map<string, NodeExecutionResult["status"]>();
- if (
- edge.targetHandle &&
- edge.targetHandle in executionResult.input_data
- ) {
+ const inputValue = edge.targetHandle
+ ? executionResult.input_data[edge.targetHandle]
+ : undefined;
+
+ if (inputValue !== undefined && inputValue !== null) {
beadData.set(executionResult.node_exec_id, executionResult.status);
}