fix(app): preserve question dock state across session switches by ualtinok · Pull Request #16173 · anomalyco/opencode
Issue for this PR
Closes #16172
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
When the question tool presents multiple questions in a batch, switching to another session and back resets the UI to question 1 with all answers lost. This happens because SessionQuestionDock is rendered inside <Show keyed>, so navigating away unmounts it and navigating back remounts it with fresh local state (tab: 0, answers: []).
This adds a module-level cache keyed by question request ID that saves in-progress state (tab, answers, custom, customOn) on unmount and restores it on remount. The cache is cleared after a successful reply or reject so stale drafts don't linger.
How did you verify your code works?
- LSP diagnostics clean
- Typecheck + build pass via pre-push hook
Screenshots / recordings
N/A
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR