Skip to content

Conversation

@kappa90
Copy link
Contributor

@kappa90 kappa90 commented Dec 8, 2025

Problem

The current implementation of the multi-question form is bugged, submitting a custom answer doesn't move to the next question.

Changes

  • Renamed submitCustomAnswer action to advanceToNextQuestion for better clarity on its purpose
  • Added logic to clear the custom input field and hide the input after capturing the value
  • This ensures a clean state when users move to the next question in the form

How did you test this code?

Added tests

Copy link
Contributor Author

kappa90 commented Dec 8, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kappa90 kappa90 requested a review from a team December 8, 2025 16:53
@kappa90 kappa90 force-pushed the 12-08-fix_ph-ai_fix_custom_answer_form_tool branch from 1a0af4a to 59e2e48 Compare December 8, 2025 16:56
@kappa90 kappa90 marked this pull request as ready for review December 8, 2025 16:57
Copilot AI review requested due to automatic review settings December 8, 2025 16:57
Copy link
Contributor

@greptile-apps greptile-apps bot left a 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

Edit Code Review Agent Settings | Greptile

Comment on lines +99 to +101
// Clear custom input and hide the input field after capturing the value
actions.setCustomInput('')
actions.setShowCustomInput(false)
Copy link
Contributor

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)

Suggested change
// 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.

Copy link
Contributor

Copilot AI left a 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 advanceToNextQuestion action to handle progression logic separately
  • Updated reducers to clear customInput and hide showCustomInput when advancing
  • Added explicit clearing logic in submitCustomAnswer listener 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: () => '',
Copy link

Copilot AI Dec 8, 2025

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:

  1. Actually renaming submitCustomAnswer to a more appropriate name throughout the codebase if that was the intent, OR
  2. Keeping submitCustomAnswer as-is and updating the PR description to reflect that advanceToNextQuestion is a new helper action, not a rename

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

Size Change: 0 B

Total Size: 3.51 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 3.51 MB

compressed-size-action

@kappa90 kappa90 force-pushed the 12-08-fix_ph-ai_fix_custom_answer_form_tool branch from 59e2e48 to bdfe401 Compare December 8, 2025 17:07
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.

3 participants