The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix function input computation in workflow code step (#12440)
martmull0e68602030ec
diff --git a/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useServerlessFunctionUpdateFormState.ts b/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useServerlessFunctionUpdateFormState.tsindex 432ee01e5a1..b89eace84c4 100644--- a/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useServerlessFunctionUpdateFormState.ts+++ b/packages/twenty-front/src/modules/settings/serverless-functions/hooks/useServerlessFunctionUpdateFormState.ts@@ -47,7 +47,7 @@ export const useServerlessFunctionUpdateFormState = ({const { loading } = useGetOneServerlessFunctionSourceCode({id: serverlessFunctionId,version: serverlessFunctionVersion,- onCompleted: (data: FindOneServerlessFunctionSourceCodeQuery) => {+ onCompleted: async (data: FindOneServerlessFunctionSourceCodeQuery) => {const newState = {code: data?.getServerlessFunctionSourceCode || undefined,name: serverlessFunction?.name || '',@@ -63,9 +63,11 @@ export const useServerlessFunctionUpdateFormState = ({const sourceCode =data?.getServerlessFunctionSourceCode?.[INDEX_FILE_PATH];+ const functionInput = await getFunctionInputFromSourceCode(sourceCode);+setServerlessFunctionTestData((prev) => ({...prev,- input: getFunctionInputFromSourceCode(sourceCode),+ input: functionInput,shouldInitInput: false,}));}diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionServerlessFunction.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionServerlessFunction.tsxindex 2b43b89cde2..9f237cc8504 100644--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionServerlessFunction.tsx+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/code-action/components/WorkflowEditActionServerlessFunction.tsx@@ -150,7 +150,7 @@ export const WorkflowEditActionServerlessFunction = ({return;}- const newFunctionInput = getFunctionInputFromSourceCode(sourceCode);+ const newFunctionInput = await getFunctionInputFromSourceCode(sourceCode);const newMergedInput = mergeDefaultFunctionInputAndFunctionInput({newInput: newFunctionInput,oldInput: action.settings.input.serverlessFunctionInput,