Fix function input computation in workflow code step (#12440)
As title Fix consist by awaiting for getFunctionInputFromSourceCode response
This commit is contained in:
@ -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,
|
||||
}));
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user