-
Notifications
You must be signed in to change notification settings - Fork 2.1k
fix(ph-ai): fix custom answer form tool #42955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
1a0af4a to
59e2e48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 1 comment
| // Clear custom input and hide the input field after capturing the value | ||
| actions.setCustomInput('') | ||
| actions.setShowCustomInput(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
style: Redundant state clearing - advanceToNextQuestion() action already clears these via reducers (lines 39, 47)
| // Clear custom input and hide the input field after capturing the value | |
| actions.setCustomInput('') | |
| actions.setShowCustomInput(false) | |
| // State will be cleared by advanceToNextQuestion reducer |
Prompt To Fix With AI
This is a comment left during a code review.
Path: frontend/src/scenes/max/messages/multiQuestionFormLogic.ts
Line: 99:101
Comment:
**style:** Redundant state clearing - `advanceToNextQuestion()` action already clears these via reducers (lines 39, 47)
```suggestion
// State will be cleared by advanceToNextQuestion reducer
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a bug where submitting a custom answer in the multi-question form didn't move to the next question. The fix adds logic to clear the custom input field and hide it after submission, ensuring a clean state for the next question.
Key Changes:
- Added
advanceToNextQuestionaction to handle progression logic separately - Updated reducers to clear
customInputand hideshowCustomInputwhen advancing - Added explicit clearing logic in
submitCustomAnswerlistener for last-question scenario - Added comprehensive test coverage for the form logic
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| frontend/src/scenes/max/messages/multiQuestionFormLogic.ts | Added advanceToNextQuestion action, updated reducers to clear input state on advancement, and added explicit clearing in submitCustomAnswer listener |
| frontend/src/scenes/max/messages/multiQuestionFormLogic.test.ts | Added comprehensive test suite covering option selection, custom answer submission, multi-question flows, and selector validation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| setCustomInput: (_: string, { value }) => value, | ||
| selectOption: () => '', | ||
| submitCustomAnswer: () => '', | ||
| advanceToNextQuestion: () => '', |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reducer for customInput now clears on advanceToNextQuestion, but the PR description states this action was renamed from submitCustomAnswer. However, submitCustomAnswer still exists as an action (line 22) and is still used throughout the codebase. This creates naming confusion.
The actual behavior is that submitCustomAnswer listener (line 89) calls advanceToNextQuestion action (line 107), which then triggers this reducer to clear the input. This is an indirect clearing mechanism that could be confusing for future maintainers.
Consider either:
- Actually renaming
submitCustomAnswerto a more appropriate name throughout the codebase if that was the intent, OR - Keeping
submitCustomAnsweras-is and updating the PR description to reflect thatadvanceToNextQuestionis a new helper action, not a rename
|
Size Change: 0 B Total Size: 3.51 MB ℹ️ View Unchanged
|
59e2e48 to
bdfe401
Compare

Problem
The current implementation of the multi-question form is bugged, submitting a custom answer doesn't move to the next question.
Changes
submitCustomAnsweraction toadvanceToNextQuestionfor better clarity on its purposeHow did you test this code?
Added tests