From b547aeb99f9d3925c3def8f565bc300974f2ee0c Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 19 Dec 2025 23:53:41 +0000 Subject: [PATCH] Refactor: Use blockId for webhook URLs for consistency Co-authored-by: emir --- .../components/workflow-block/workflow-block.tsx | 9 ++++----- apps/sim/hooks/use-webhook-management.ts | 10 ++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx index a24d3ff9e4..a3ebc3dab5 100644 --- a/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx +++ b/apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/workflow-block/workflow-block.tsx @@ -363,11 +363,10 @@ const SubBlockRow = ({ return null } const baseUrl = getBaseUrl() - const triggerPath = allSubBlockValues?.triggerPath?.value as string | undefined - return triggerPath - ? `${baseUrl}/api/webhooks/trigger/${triggerPath}` - : `${baseUrl}/api/webhooks/trigger/${blockId}` - }, [subBlock?.id, blockId, allSubBlockValues]) + // Always use blockId for consistency - the webhook path should always match blockId + // This prevents the URL from changing after loading webhook data + return `${baseUrl}/api/webhooks/trigger/${blockId}` + }, [subBlock?.id, blockId]) const allVariables = useVariablesStore((state) => state.variables) diff --git a/apps/sim/hooks/use-webhook-management.ts b/apps/sim/hooks/use-webhook-management.ts index 1fb777fe8c..618502855f 100644 --- a/apps/sim/hooks/use-webhook-management.ts +++ b/apps/sim/hooks/use-webhook-management.ts @@ -108,13 +108,11 @@ export function useWebhookManagement({ const isChecked = useSubBlockStore((state) => state.checkedWebhooks.has(blockId)) const webhookUrl = useMemo(() => { - if (!webhookPath) { - const baseUrl = getBaseUrl() - return `${baseUrl}/api/webhooks/trigger/${blockId}` - } const baseUrl = getBaseUrl() - return `${baseUrl}/api/webhooks/trigger/${webhookPath}` - }, [webhookPath, blockId]) + // Always use blockId for consistency - the webhook path should always match blockId + // This prevents the URL from changing after loading webhook data from the API + return `${baseUrl}/api/webhooks/trigger/${blockId}` + }, [blockId]) const [isSaving, setIsSaving] = useState(false)