fix: add null safety checks in webhook response status hook (#12114)

### What problem does this PR solve?

Add optional chaining operators to prevent runtime errors when formData
is undefined or null in useShowWebhookResponseStatus hook.

This fixes a potential crash when accessing mode and execution_mode
properties before formData is initialized or when the Begin node doesn't
exist in the graph.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
SalmonWu13
2025-12-23 16:16:30 +08:00
committed by GitHub
parent b47f1afa35
commit f63f007326

View File

@ -16,7 +16,7 @@ export function useShowWebhookResponseStatus(form: UseFormReturn<any>) {
const formData: BeginFormSchemaType = getNode(BeginId)?.data.form;
return (
formData?.mode === AgentDialogueMode.Webhook &&
formData.execution_mode === WebhookExecutionMode.Streaming
formData?.execution_mode === WebhookExecutionMode.Streaming
);
}, [getNode]);