fix(workflow): derive the webhook URL only where a sub-block shows one (#6758)

`sub-block.tsx` mounts `useWebhookManagement` for every sub-block in the editor
panel, and `getBaseUrl()` throws when NEXT_PUBLIC_APP_URL reads empty, so a
missing deployment value took down the whole workflow route instead of the one
webhook field. The hook already gates its query and store writes on
`useWebhookUrl`; the URL now agrees.
This commit is contained in:
Waleed
2026-08-15 18:32:41 -07:00
committed by GitHub
parent 4bc89c9256
commit 57611bda18
+12 -1
View File
@@ -100,13 +100,24 @@ export function useWebhookManagement({
useCallback((state) => state.getValue(blockId, 'triggerPath') as string | null, [blockId])
)
/**
* Derived only when the caller actually renders the URL. `getBaseUrl()` throws
* when `NEXT_PUBLIC_APP_URL` is unset, and `sub-block.tsx` mounts this hook for
* every sub-block in the editor panel deriving the URL unconditionally turns
* a missing deployment value into a render throw for fields that never display
* one, taking down the whole editor instead of the single webhook field.
* Consumers already gate their reads on `useWebhookUrl`.
*/
const webhookUrl = useMemo(() => {
if (!useWebhookUrl) {
return ''
}
const baseUrl = getBaseUrl()
if (!webhookPath) {
return `${baseUrl}/api/webhooks/trigger/${blockId}`
}
return `${baseUrl}/api/webhooks/trigger/${webhookPath}`
}, [webhookPath, blockId])
}, [useWebhookUrl, webhookPath, blockId])
useEffect(() => {
if (triggerId && !isPreview) {