fix(ui): preserve other pending answers on needs-input submit#641
Open
emrahzunicaplab wants to merge 2 commits into
Open
fix(ui): preserve other pending answers on needs-input submit#641emrahzunicaplab wants to merge 2 commits into
emrahzunicaplab wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the UI behavior where submitting one question in a pending_questions batch causes the action panel to fully re-render and lose unsubmitted selections/free-text drafts on sibling questions. This stays entirely client-side by persisting per-question drafts in module state and re-applying them on re-render.
Changes:
- Added an in-memory draft store for task-level batch questions (
taskQuestionDrafts) keyed by task/question id. - Updated
renderTaskQuestionsItemto restore option selection and free-text from the draft store on every paint. - Updated action handlers to record draft state on option selection / free-text input, and clear it once a question is successfully submitted.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Comment on lines
+410
to
+414
| ${questions.map((q, idx) => { | ||
| // Restore any un-submitted selection for this question so a | ||
| // re-render (e.g. after a sibling question is submitted) | ||
| // does not wipe it — see taskQuestionDrafts (issue #622). | ||
| const draft = (taskQuestionDrafts[taskId] || {})[q.id] || {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue
Closes #622
Summary of changes
renderActionItemsfully rebuilds the action-required panel's DOM after anyquestion submit (
container.innerHTML = ...), so submitting one question ina
pending_questionsbatch wiped the.selectedstate and free-text draftson sibling, un-submitted questions — the only place that state lived.
Added a small client-side draft store (
taskQuestionDrafts) insrc/ui/static/modules/actions.jsthat records each un-submittedselection/free-text as the user makes it, and re-applies it whenever
renderTaskQuestionsItemrepaints. The draft for a question is cleared oncethe server confirms it's answered. No API or backend changes — this keeps
the existing per-question submit/resume contract documented in
PRD-029 (
pending_questions[]: "mark answered per question; move when alldone"), rather than moving to a single "Submit all" action.
Screenshots / recordings
Before/after recording: on main, submitting one question in the 4-question batch wipes the in-progress selections on the other pending questions; on this branch, sibling selections/drafts are preserved across submits until each question is answered.
Before.mp4
After.mp4
Testing notes
Repro'd with a seeded
needs-inputtask carrying 4pending_questions(
extensions.runner.pending_questions) against a localdotbot serveinstance:
previously they were wiped.
"No pending actions" once the last question is answered.
Checklist