fix: make not filled required fields be validated before sending to the backend#8711
Conversation
…ppear as toast instead of build error
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis update introduces selective subgraph validation in the flow-building logic, adds error propagation for message sending, and updates related type signatures to asynchronous patterns. It also introduces a utility for subgraph extraction, improves error handling and reporting, and makes minor code cleanups and event handling adjustments in the chat input components. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ChatInput
participant ChatView
participant PlaygroundModal
participant FlowStore
User->>ChatInput: Trigger send (e.g., keydown)
ChatInput->>ChatView: await sendMessage({repeat, files})
ChatView->>PlaygroundModal: await sendMessage({repeat, files})
PlaygroundModal->>FlowStore: await buildFlow()
FlowStore->>FlowStore: Validate subgraph (upstream/downstream)
alt Validation error
FlowStore-->>PlaygroundModal: throw Error
PlaygroundModal-->>ChatView: throw Error
ChatView-->>ChatInput: throw Error
ChatInput->>ChatInput: Restore chat input state
else Success
FlowStore-->>PlaygroundModal: Success
PlaygroundModal-->>ChatView: Success
ChatView->>ChatView: track("Playground Message Sent")
end
ChatInput->>ChatInput: Clear files state
Suggested labels
Suggested reviewers
✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
…he backend (langflow-ai#8711) * Added validation for nodes before building, make validation message appear as toast instead of build error * Make subgraph validation not occur in flowStore * Added function to search for connected nodes down or upstream * Added validation before flow starts of the connected flows * Catch error when sending message and restore chat value * Made enter not behave as enter on chat input text area * made sendMessage be async and throw errors * Added build status error to the nodes that didn't make it past validation. * Fixed flow not running when not every edge is showed --------- Co-authored-by: Mike Fortman <michael.fortman@datastax.com>

This pull request introduces several updates to the chat input functionality, error handling, and utility methods in the codebase. The most significant changes include adding error recovery for chat input, improving edge validation logic, and introducing a utility for subgraph traversal. Additionally, some type definitions and unused imports have been updated.
Chat Input Enhancements:
sendmethod ofchat-input.tsxto reset the chat value in case of a failure during message sending.onKeyDownevent intext-area-wrapper.tsxto ensure proper handling of the "Enter" key when sending messages.sendMessageinchat-view.tsxto be asynchronous for consistency with other chat input changes.Edge Validation and Subgraph Utility:
flowStore.tsto validate only relevant subgraphs (upstream or downstream) based on provided node IDs, using the newly introducedgetConnectedSubgraphutility.getConnectedSubgraphutility inreactflowUtils.tsto retrieve all connected nodes and edges in a specified direction (upstream or downstream) from a given node.Type and Code Cleanup:
index.tsto reflect the asynchronous nature ofsendMessage. [1] [2]BASE_URL_API) frombuildUtils.ts.Summary by CodeRabbit