@@ -55,11 +55,25 @@ export function useWebhookManagement({
5555 const webhookUrl = useMemo ( ( ) => {
5656 if ( ! webhookPath ) {
5757 const baseUrl = getBaseUrl ( )
58- return `${ baseUrl } /api/webhooks/trigger/${ blockId } `
58+ const url = `${ baseUrl } /api/webhooks/trigger/${ blockId } `
59+ logger . debug ( 'Webhook URL generated using blockId fallback' , {
60+ blockId,
61+ url,
62+ hasWebhookPath : false ,
63+ webhookId,
64+ } )
65+ return url
5966 }
6067 const baseUrl = getBaseUrl ( )
61- return `${ baseUrl } /api/webhooks/trigger/${ webhookPath } `
62- } , [ webhookPath , blockId ] )
68+ const url = `${ baseUrl } /api/webhooks/trigger/${ webhookPath } `
69+ logger . debug ( 'Webhook URL generated using triggerPath' , {
70+ blockId,
71+ triggerPath : webhookPath ,
72+ url,
73+ webhookId,
74+ } )
75+ return url
76+ } , [ webhookPath , blockId , webhookId ] )
6377
6478 const [ isSaving , setIsSaving ] = useState ( false )
6579
@@ -81,16 +95,33 @@ export function useWebhookManagement({
8195 const currentlyLoading = store . loadingWebhooks . has ( blockId )
8296 const alreadyChecked = store . checkedWebhooks . has ( blockId )
8397 const currentWebhookId = store . getValue ( blockId , 'webhookId' )
98+ const currentTriggerPath = store . getValue ( blockId , 'triggerPath' )
99+
100+ logger . debug ( 'Webhook management check' , {
101+ blockId,
102+ currentlyLoading,
103+ alreadyChecked,
104+ currentWebhookId,
105+ currentTriggerPath,
106+ workflowId,
107+ } )
84108
85109 if ( currentlyLoading ) {
110+ logger . debug ( 'Skipping webhook fetch - already loading' , { blockId } )
86111 return
87112 }
88113
89114 if ( alreadyChecked && currentWebhookId ) {
115+ logger . debug ( 'Skipping webhook fetch - already checked and has webhookId' , {
116+ blockId,
117+ webhookId : currentWebhookId ,
118+ triggerPath : currentTriggerPath ,
119+ } )
90120 return
91121 }
92122
93123 if ( alreadyChecked && ! currentWebhookId ) {
124+ logger . debug ( 'Removing from checkedWebhooks - was checked but no webhookId' , { blockId } )
94125 useSubBlockStore . setState ( ( state ) => {
95126 const newSet = new Set ( state . checkedWebhooks )
96127 newSet . delete ( blockId )
@@ -106,6 +137,7 @@ export function useWebhookManagement({
106137 return
107138 }
108139
140+ logger . debug ( 'Starting webhook fetch' , { blockId, workflowId } )
109141 useSubBlockStore . setState ( ( state ) => ( {
110142 loadingWebhooks : new Set ( [ ...state . loadingWebhooks , blockId ] ) ,
111143 } ) )
@@ -132,7 +164,24 @@ export function useWebhookManagement({
132164 const currentPath = useSubBlockStore . getState ( ) . getValue ( blockId , 'triggerPath' )
133165 if ( webhook . path !== currentPath ) {
134166 useSubBlockStore . getState ( ) . setValue ( blockId , 'triggerPath' , webhook . path )
167+ logger . debug ( 'Webhook path updated from API' , {
168+ blockId,
169+ oldPath : currentPath ,
170+ newPath : webhook . path ,
171+ webhookId : webhook . id ,
172+ } )
173+ } else {
174+ logger . debug ( 'Webhook path unchanged' , {
175+ blockId,
176+ path : webhook . path ,
177+ webhookId : webhook . id ,
178+ } )
135179 }
180+ } else {
181+ logger . debug ( 'Webhook loaded but has no path' , {
182+ blockId,
183+ webhookId : webhook . id ,
184+ } )
136185 }
137186
138187 if ( webhook . providerConfig ) {
0 commit comments