Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ui/src/pages/RoutineDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,10 @@ export function RoutineDetail() {
webhookUrl: result.secretMaterial.webhookUrl,
webhookSecret: result.secretMaterial.webhookSecret,
});
} else {
pushToast({ title: "Trigger added", tone: "success" });
}
setNewTrigger({ kind: "schedule", cronExpression: "0 10 * * *", signingMode: "bearer", replayWindowSec: "300" });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Form also resets for webhook triggers

setNewTrigger(...) is now unconditionally called for both webhook and schedule trigger creation. For webhook triggers this means the form resets even though the user is shown the secretMessage banner (which is fine UX), but it is a behaviour change versus the pre-PR code. It's worth confirming this is intentional: should a webhook creator be able to create a second webhook immediately after without re-selecting the "webhook" kind from the dropdown? Currently the form snaps back to kind: "schedule" for both paths.

If the reset for webhook triggers is not desired, moving the call inside the else block is the minimal fix:

Suggested change
setNewTrigger({ kind: "schedule", cronExpression: "0 10 * * *", signingMode: "bearer", replayWindowSec: "300" });
setNewTrigger({ kind: "schedule", cronExpression: "0 10 * * *", signingMode: "bearer", replayWindowSec: "300" });

(no change needed — just flagging so it's a conscious decision rather than an accidental side-effect)

Prompt To Fix With AI
This is a comment left during a code review.
Path: ui/src/pages/RoutineDetail.tsx
Line: 482

Comment:
**Form also resets for webhook triggers**

`setNewTrigger(...)` is now unconditionally called for both webhook and schedule trigger creation. For webhook triggers this means the form resets even though the user is shown the `secretMessage` banner (which is fine UX), but it is a behaviour change versus the pre-PR code. It's worth confirming this is intentional: should a webhook creator be able to create a second webhook immediately after without re-selecting the "webhook" kind from the dropdown? Currently the form snaps back to `kind: "schedule"` for both paths.

If the reset for webhook triggers is not desired, moving the call inside the `else` block is the minimal fix:

```suggestion
      setNewTrigger({ kind: "schedule", cronExpression: "0 10 * * *", signingMode: "bearer", replayWindowSec: "300" });
```
(no change needed — just flagging so it's a conscious decision rather than an accidental side-effect)

How can I resolve this? If you propose a fix, please make it concise.

await Promise.all([
queryClient.invalidateQueries({ queryKey: queryKeys.routines.detail(routineId!) }),
queryClient.invalidateQueries({ queryKey: queryKeys.routines.list(selectedCompanyId!) }),
Expand All @@ -495,6 +498,7 @@ export function RoutineDetail() {
const updateTrigger = useMutation({
mutationFn: ({ id, patch }: { id: string; patch: Record<string, unknown> }) => routinesApi.updateTrigger(id, patch),
onSuccess: async () => {
pushToast({ title: "Trigger saved", tone: "success" });
await Promise.all([
queryClient.invalidateQueries({ queryKey: queryKeys.routines.detail(routineId!) }),
queryClient.invalidateQueries({ queryKey: queryKeys.routines.list(selectedCompanyId!) }),
Expand Down