-
Notifications
You must be signed in to change notification settings - Fork 12k
feat: add routing form triggers to workflows #23421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
b0d048a
a327a38
a2fef5f
1a86cb0
b161f8f
3f4f743
a4e3015
dd791ff
94ebb23
1062d1a
9025eaa
190eb0b
3cd2d7e
a39ccf4
265f852
7642992
53fe81e
32910d8
e037154
2a187ea
d0e0fee
505ff8e
37c78b0
b945b88
ac54670
32a26e5
0f0e2fa
75d1235
edcbca5
2feb0ea
1278b63
7825c4a
2168142
8d58550
2ea8c1e
61d231a
985b777
c9ae4f5
6ff24a9
99e2ac7
87f8857
d27e45f
59a4c9c
fdc18cb
a9ab403
4874a6f
24dd93f
4429ced
3b5e530
c13dcbe
e2768cc
b957355
3672d04
57a7d9b
72422b0
a659afc
a35e1ec
1b9962f
6be759d
4fdd9b6
9c6b365
078df04
97c5572
805f8be
1ab36bd
ab1a14c
200f3fa
239f3db
952cf34
b57f4a4
026762f
737b643
19a9aaf
50a994c
024c888
42fe72c
a702b71
0dc6b08
672c1d7
bc4e630
d7b0117
e14adee
4d6356c
1c03eed
1603f44
8362a7f
c8ccd40
f82dfd6
3494c61
557f0f4
6b4aaf7
23751d0
e1a234f
a5c3be2
a69f86d
4e48e9c
4c65847
82e7d41
cfe2068
6ba946b
4c557e7
fe627db
af86d6b
2931206
7e0e572
1d3f76f
0e38ce9
7451a79
9303773
eac7306
91253e3
43a788c
32de973
ddd343e
6b8e602
d20accd
3554cdd
07a15f2
25ff5a7
6801f3f
0a3590a
b294e22
520f3bc
2e115ea
380f9fa
d9ed5b3
b159476
b5b6878
6a90b6a
01ead92
6eac654
2cc85dc
d551320
eadb532
d0ca589
594e162
069ae98
fec95f3
8766ae4
78ad4b1
46e0c23
25e05c0
ec9795e
c6a7919
7c77d9a
7aa47b1
46da699
fe5db4f
9ab0a5a
91e0152
3b1533e
f43e786
af9fab6
1916768
d437af5
763023f
a120784
894dbb4
51db2d0
a3d4349
146cffc
f4da96d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,6 +29,7 @@ import { | |
| import { | ||
| OnAfterEventTriggerDto, | ||
| OnBeforeEventTriggerDto, | ||
| OnFormSubmittedNoEventTriggerDto, | ||
| TIME_UNIT_TO_ENUM, | ||
| WORKFLOW_TRIGGER_TO_ENUM, | ||
| } from "../inputs/workflow-trigger.input"; | ||
|
|
@@ -136,22 +137,25 @@ export class WorkflowsInputService { | |
| : currentData.trigger; | ||
| const timeUnitForZod = | ||
| updateDto.trigger instanceof OnBeforeEventTriggerDto || | ||
| updateDto.trigger instanceof OnAfterEventTriggerDto | ||
| updateDto.trigger instanceof OnAfterEventTriggerDto || | ||
| updateDto.trigger instanceof OnFormSubmittedNoEventTriggerDto | ||
| ? updateDto?.trigger?.offset?.unit ?? currentData.timeUnit ?? null | ||
| : undefined; | ||
CarinaWolli marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
Comment on lines
139
to
144
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don’t null-out time/timeUnit when trigger isn’t provided If updateDto.trigger is undefined, current code sets time/timeUnit to null, unintentionally clearing persisted offsets and triggering reschedules. Apply this diff to preserve existing values unless the trigger changes to a non-offset variant: - const timeUnitForZod =
- updateDto.trigger instanceof OnBeforeEventTriggerDto ||
- updateDto.trigger instanceof OnAfterEventTriggerDto ||
- updateDto.trigger instanceof OnFormSubmittedNoEventTriggerDto
- ? updateDto?.trigger?.offset?.unit ?? currentData.timeUnit ?? null
- : undefined;
+ const isDtoOffsetBased =
+ updateDto.trigger instanceof OnBeforeEventTriggerDto ||
+ updateDto.trigger instanceof OnAfterEventTriggerDto ||
+ updateDto.trigger instanceof OnFormSubmittedNoEventTriggerDto;
+
+ const timeUnitForZod =
+ updateDto.trigger === undefined
+ ? currentData.timeUnit ?? null
+ : isDtoOffsetBased
+ ? updateDto.trigger.offset?.unit ?? currentData.timeUnit ?? null
+ : null;
@@
- time:
- updateDto.trigger instanceof OnBeforeEventTriggerDto ||
- updateDto.trigger instanceof OnAfterEventTriggerDto ||
- updateDto.trigger instanceof OnFormSubmittedNoEventTriggerDto
- ? updateDto?.trigger?.offset?.value ?? currentData?.time ?? null
- : null,
+ time:
+ updateDto.trigger === undefined
+ ? currentData.time ?? null
+ : isDtoOffsetBased
+ ? updateDto.trigger.offset?.value ?? currentData.time ?? null
+ : null,Also applies to: 156-160 🤖 Prompt for AI Agents |
||
| const updateData: TUpdateInputSchema = { | ||
| id: workflowIdToUse, | ||
| name: updateDto.name ?? currentData.name, | ||
| activeOn: | ||
| activeOnEventTypeIds: | ||
| updateDto?.activation?.activeOnEventTypeIds ?? | ||
| currentData?.activeOn.map((active) => active.eventTypeId) ?? | ||
| [], | ||
| activeOnRoutingFormIds: updateDto?.activation?.activeOnRoutingFormIds ?? [], | ||
| steps: mappedSteps, | ||
| trigger: triggerForZod, | ||
| time: | ||
| updateDto.trigger instanceof OnBeforeEventTriggerDto || | ||
| updateDto.trigger instanceof OnAfterEventTriggerDto | ||
| updateDto.trigger instanceof OnAfterEventTriggerDto || | ||
| updateDto.trigger instanceof OnFormSubmittedNoEventTriggerDto | ||
| ? updateDto?.trigger?.offset?.value ?? currentData?.time ?? null | ||
| : null, | ||
| timeUnit: timeUnitForZod ? TIME_UNIT_TO_ENUM[timeUnitForZod] : null, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.