Fix test data disapear (#10846)

As title. Init input from source code only once.
This commit is contained in:
martmull
2025-03-13 12:08:29 +01:00
committed by GitHub
parent f66ae3eff6
commit 3f7315c2dc
3 changed files with 29 additions and 20 deletions

View File

@ -3,6 +3,7 @@ import { ServerlessFunctionExecutionStatus } from '~/generated-metadata/graphql'
export type ServerlessFunctionTestData = {
input: { [field: string]: any };
shouldInitInput: boolean;
output: {
data?: string;
logs: string;
@ -29,6 +30,7 @@ export const serverlessFunctionTestDataFamilyState = createFamilyState<
language: 'plaintext',
height: 64,
input: {},
shouldInitInput: true,
output: DEFAULT_OUTPUT_VALUE,
},
});

View File

@ -337,16 +337,18 @@ export const WorkflowEditActionServerlessFunction = ({
isTesting={isTesting}
/>
</StyledCodeEditorContainer>
<StyledCodeEditorContainer>
<InputLabel>Logs</InputLabel>
<TextArea
value={
isTesting ? '' : serverlessFunctionTestData.output.logs
}
maxRows={20}
disabled
/>
</StyledCodeEditorContainer>
{serverlessFunctionTestData.output.logs.length > 0 && (
<StyledCodeEditorContainer>
<InputLabel>Logs</InputLabel>
<TextArea
value={
isTesting ? '' : serverlessFunctionTestData.output.logs
}
maxRows={20}
disabled
/>
</StyledCodeEditorContainer>
)}
</>
)}
</WorkflowStepBody>