From 25227db9f7f902a150491800bba01e0cb30bd740 Mon Sep 17 00:00:00 2001 From: anovazzi1 Date: Mon, 23 Oct 2023 17:10:12 -0300 Subject: [PATCH] fix(tabsContext.tsx): remove unnecessary line that sets official property to false on component.node fix(nodeToolbarComponent/index.tsx): fix downloadNode function call to pass a deep clone of data instead of the original data object fix(reactflowUtils.ts): remove unnecessary line that sets official property to false on nodeData.node --- src/frontend/src/contexts/tabsContext.tsx | 1 - .../pages/FlowPage/components/nodeToolbarComponent/index.tsx | 3 +-- src/frontend/src/utils/reactflowUtils.ts | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/frontend/src/contexts/tabsContext.tsx b/src/frontend/src/contexts/tabsContext.tsx index 4070581de..227593c1d 100644 --- a/src/frontend/src/contexts/tabsContext.tsx +++ b/src/frontend/src/contexts/tabsContext.tsx @@ -697,7 +697,6 @@ export function TabsProvider({ children }: { children: ReactNode }) { ` (${increment})`; } } - component.node!.official = false; addFlow(true, createFlowComponent(component)); } diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx index 6a920c96f..b28eedbe5 100644 --- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx @@ -75,8 +75,7 @@ export default function NodeToolbarComponent({ updateNodeInternals(data.id); break; case "Download": - //TODO add logic to save node on backend and update toolbar - downloadNode(createFlowComponent(data)); + downloadNode(createFlowComponent(cloneDeep(data))); break; case "Share": //TODO add logic to save node on backend and update toolbar diff --git a/src/frontend/src/utils/reactflowUtils.ts b/src/frontend/src/utils/reactflowUtils.ts index 3f26d8098..cf62f2694 100644 --- a/src/frontend/src/utils/reactflowUtils.ts +++ b/src/frontend/src/utils/reactflowUtils.ts @@ -1065,6 +1065,7 @@ export function getGroupStatus( } export function createFlowComponent(nodeData: NodeDataType): FlowType { + nodeData.node!.official = false; const flowNode: FlowType = { data: { edges: [],