From fc6cebb9754400fce88b2215fc34dbe36598be60 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Sat, 9 Dec 2023 10:57:36 +1100 Subject: [PATCH] fix(ui): fix extra attrs added to workflow payload --- .../frontend/web/src/features/nodes/hooks/useWorkflow.ts | 4 +--- .../web/src/features/nodes/util/workflow/buildWorkflow.ts | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts b/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts index 5ad9bb675f..fecb15c2e9 100644 --- a/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts +++ b/invokeai/frontend/web/src/features/nodes/hooks/useWorkflow.ts @@ -1,6 +1,5 @@ import { useAppSelector } from 'app/store/storeHooks'; import { buildWorkflow } from 'features/nodes/util/workflow/buildWorkflow'; -import { omit } from 'lodash-es'; import { useMemo } from 'react'; import { useDebounce } from 'use-debounce'; @@ -12,8 +11,7 @@ export const useWorkflow = () => { const [edges] = useDebounce(edges_, 300); const [workflow] = useDebounce(workflow_, 300); const builtWorkflow = useMemo( - () => - buildWorkflow({ nodes, edges, workflow: omit(workflow, 'isTouched') }), + () => buildWorkflow({ nodes, edges, workflow }), [nodes, edges, workflow] ); diff --git a/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts b/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts index 9f1e9f7294..26cf7ada4e 100644 --- a/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts +++ b/invokeai/frontend/web/src/features/nodes/util/workflow/buildWorkflow.ts @@ -1,6 +1,6 @@ import { logger } from 'app/logging/logger'; import { parseify } from 'common/util/serialize'; -import { NodesState } from 'features/nodes/store/types'; +import { NodesState, WorkflowsState } from 'features/nodes/store/types'; import { isInvocationNode, isNotesNode } from 'features/nodes/types/invocation'; import { WorkflowV2, @@ -8,13 +8,13 @@ import { zWorkflowNode, } from 'features/nodes/types/workflow'; import i18n from 'i18next'; -import { cloneDeep } from 'lodash-es'; +import { cloneDeep, omit } from 'lodash-es'; import { fromZodError } from 'zod-validation-error'; type BuildWorkflowArg = { nodes: NodesState['nodes']; edges: NodesState['edges']; - workflow: Omit; + workflow: WorkflowsState; }; type BuildWorkflowFunction = (arg: BuildWorkflowArg) => WorkflowV2; @@ -29,7 +29,7 @@ export const buildWorkflow: BuildWorkflowFunction = ({ const clonedEdges = cloneDeep(edges); const newWorkflow: WorkflowV2 = { - ...clonedWorkflow, + ...omit(clonedWorkflow, 'isTouched', 'id'), nodes: [], edges: [], };