Skip to content

Commit 7575cd6

Browse files
Merge pull request #2451 from simstudioai/improvement/SIM-514-useWebhookUrl-conditioning
improvement(useWebhookUrl): GET api/webhook is called when useWebhookUrl:true
2 parents 25f7ed2 + fbde64f commit 7575cd6

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/short-input/short-input.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ export function ShortInput({
9090
blockId,
9191
triggerId: undefined,
9292
isPreview,
93+
useWebhookUrl,
9394
})
9495

9596
const wandHook = useWand({

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/editor/components/sub-block/components/trigger-save/trigger-save.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export function TriggerSave({
7474
blockId,
7575
triggerId: effectiveTriggerId,
7676
isPreview,
77+
useWebhookUrl: true, // to store the webhook url in the store
7778
})
7879

7980
const triggerConfig = useSubBlockStore((state) => state.getValue(blockId, 'triggerConfig'))

apps/sim/hooks/use-webhook-management.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ interface UseWebhookManagementProps {
1414
blockId: string
1515
triggerId?: string
1616
isPreview?: boolean
17+
useWebhookUrl?: boolean
1718
}
1819

1920
interface WebhookManagementState {
@@ -90,6 +91,7 @@ export function useWebhookManagement({
9091
blockId,
9192
triggerId,
9293
isPreview = false,
94+
useWebhookUrl = false,
9395
}: UseWebhookManagementProps): WebhookManagementState {
9496
const params = useParams()
9597
const workflowId = params.workflowId as string
@@ -204,9 +206,10 @@ export function useWebhookManagement({
204206
})
205207
}
206208
}
207-
208-
loadWebhookOrGenerateUrl()
209-
}, [isPreview, triggerId, workflowId, blockId])
209+
if (useWebhookUrl) {
210+
loadWebhookOrGenerateUrl()
211+
}
212+
}, [isPreview, triggerId, workflowId, blockId, useWebhookUrl])
210213

211214
const createWebhook = async (
212215
effectiveTriggerId: string | undefined,

0 commit comments

Comments
 (0)