fix(plugin-workflow): fix sync collection trigger transaction (#3437)
This commit is contained in:
parent
d692d9cf1b
commit
dada993d80
@ -85,17 +85,23 @@ async function handler(this: CollectionTrigger, workflow: WorkflowModel, data: M
|
|||||||
// TODO: `result.toJSON()` throws error
|
// TODO: `result.toJSON()` throws error
|
||||||
const json = toJSON(result);
|
const json = toJSON(result);
|
||||||
|
|
||||||
const promise = this.workflow.trigger(
|
|
||||||
workflow,
|
|
||||||
{ data: json },
|
|
||||||
{
|
|
||||||
context,
|
|
||||||
transaction,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
if (workflow.sync) {
|
if (workflow.sync) {
|
||||||
await promise;
|
await this.workflow.trigger(
|
||||||
|
workflow,
|
||||||
|
{ data: json },
|
||||||
|
{
|
||||||
|
context,
|
||||||
|
transaction,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
this.workflow.trigger(
|
||||||
|
workflow,
|
||||||
|
{ data: json },
|
||||||
|
{
|
||||||
|
context,
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user