fix(plugin-workflow-manual): fix result values in failed status (#6160)

This commit is contained in:
Junyi 2025-02-06 16:48:55 +08:00 committed by GitHub
parent ae129df7d1
commit 032b4e4a7f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 6 deletions

View File

@ -183,7 +183,7 @@ describe('workflow > instructions > manual', () => {
expect(job.result).toEqual({ f1: { a: 2 }, _: 'resolve' });
});
it('values rejected will not be overrided by action assigned', async () => {
it('values rejected will be overrided by action assigned', async () => {
const n1 = await workflow.createNode({
type: 'manual',
config: {
@ -230,7 +230,7 @@ describe('workflow > instructions > manual', () => {
expect(execution.status).toBe(EXECUTION_STATUS.REJECTED);
const [job] = await execution.getJobs();
expect(job.status).toBe(JOB_STATUS.REJECTED);
expect(job.result).toEqual({ f1: { a: 1 }, _: 'reject' });
expect(job.result).toEqual({ f1: { a: 2 }, _: 'reject' });
});
it('values saved as pending will not be overrided by action assigned', async () => {

View File

@ -84,10 +84,9 @@ export async function submit(context: Context, next) {
userJob.set({
status: actionItem.status,
result:
actionItem.status > JOB_STATUS.PENDING
? { [formKey]: Object.assign(values.result[formKey], presetValues), _: actionKey }
: Object.assign(userJob.result ?? {}, values.result),
result: actionItem.status
? { [formKey]: Object.assign(values.result[formKey], presetValues), _: actionKey }
: Object.assign(userJob.result ?? {}, values.result),
});
const handler = instruction.formTypes.get(forms[formKey].type);