fix(ui): fix extra attrs added to workflow payload

This commit is contained in:
psychedelicious 2023-12-09 10:57:36 +11:00
parent 06104f3851
commit fc6cebb975
2 changed files with 5 additions and 7 deletions

View File

@ -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]
);

View File

@ -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<WorkflowV2, 'nodes' | 'edges'>;
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: [],
};