Skip to content

fix: reset startInputType after form submission ( #334 )#374

Open
SyncWithRaj wants to merge 1 commit intoFlowiseAI:mainfrom
SyncWithRaj:fix/form-input-payload-bug
Open

fix: reset startInputType after form submission ( #334 )#374
SyncWithRaj wants to merge 1 commit intoFlowiseAI:mainfrom
SyncWithRaj:fix/form-input-payload-bug

Conversation

@SyncWithRaj
Copy link
Copy Markdown
Contributor

Problem

When a chat agent flow has form inputs, the initial form submission works perfectly, but subsequent standard chat messages from the user fail to attach to the API payload. The client sends an empty {form: {}} object instead of the {question: "user text"} string.

Root Cause

The startInputType state is set to 'formInput' when the chatbot configuration loads, but it is never reset after the form is successfully submitted. This causes the widget to perpetually act as if it is in a form-submission state.

Fix

Added setStartInputType('') inside handleSubmit() immediately after the form payload is constructed and processed. This resets the input state, ensuring that all subsequent user messages are correctly treated as standard text questions.

Testing

  • ✅ Form submit correctly sends {form: {Var1: "test"}}
  • ✅ Next text message correctly sends {question: "user text"}
  • ✅ Message regeneration button works normally again after form submission

Fixes #334

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the autoSendInitialMessage feature, allowing the chatbot to automatically trigger a message upon loading if specific conditions are met, such as no lead capture being required. The changes span the core Bot component, where the auto-send logic and state management are implemented, as well as the Bubble and Full components to support the new theme property. Additionally, a fix was included to reset the input type after form submissions. Feedback suggests improving the reliability of the lead capture check by using the configuration object directly and adding a guard to prevent auto-sending if the user has already started typing.

Comment thread src/components/Bot.tsx Outdated
@SyncWithRaj SyncWithRaj force-pushed the fix/form-input-payload-bug branch from 5c99465 to 2b1e8cc Compare April 21, 2026 18:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Chat question not attached to the api payload when agent flow is configured for form inputs

1 participant