From 4e25b1d0b2ba7e3213ca36d6ff59c33944cc153e Mon Sep 17 00:00:00 2001 From: abhi1992002 Date: Sun, 25 Jan 2026 11:54:05 +0530 Subject: [PATCH] refactor(frontend): simplify NodeDataRenderer output handling ### Changes - Removed unused `useNodeStore` and `useShallow` imports from `NodeOutput.tsx`. - Simplified the mapping of output data in `NodeDataRenderer` by directly using `latestOutputData` values. - Updated the `handleCopy` function to use the simplified value variable. ### Impact - Streamlines the output rendering logic, improving code readability and maintainability. - Reduces unnecessary dependencies, enhancing performance. ### Testing - Verified that the output rendering remains consistent with the latest execution results. --- .../CustomNode/components/NodeOutput/NodeOutput.tsx | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsx b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsx index 4fa36cbfc3..c5df24e0e6 100644 --- a/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/build/components/FlowEditor/nodes/CustomNode/components/NodeOutput/NodeOutput.tsx @@ -12,8 +12,6 @@ import { NodeDataViewer } from "./components/NodeDataViewer/NodeDataViewer"; import { ContentRenderer } from "./components/ContentRenderer"; import { useNodeOutput } from "./useNodeOutput"; import { ViewMoreData } from "./components/ViewMoreData"; -import { useNodeStore } from "@/app/(platform)/build/stores/nodeStore"; -import { useShallow } from "zustand/react/shallow"; export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => { const { @@ -23,9 +21,6 @@ export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => { executionResultId, latestInputData, } = useNodeOutput(nodeId); - const accumulatedOutputData = useNodeStore( - useShallow((state) => state.getAccumulatedNodeOutputData(nodeId)), - ); if (Object.keys(latestOutputData).length === 0) { return null; @@ -81,8 +76,7 @@ export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => { {Object.entries(latestOutputData) .slice(0, 2) - .map(([key, latestValue]) => { - const allValue = accumulatedOutputData[key] || latestValue; + .map(([key, value]) => { return (
@@ -104,7 +98,7 @@ export const NodeDataRenderer = ({ nodeId }: { nodeId: string }) => { Data:
- {latestValue.map((item, index) => ( + {value.map((item, index) => (
{