Skip to content

fix(web): preserve composer input when planning question appears#1080

Closed
Githubguy132010 wants to merge 1 commit intopingdotgg:mainfrom
Githubguy132010:fix/issue-808-composer-input-reset
Closed

fix(web): preserve composer input when planning question appears#1080
Githubguy132010 wants to merge 1 commit intopingdotgg:mainfrom
Githubguy132010:fix/issue-808-composer-input-reset

Conversation

@Githubguy132010
Copy link

@Githubguy132010 Githubguy132010 commented Mar 14, 2026

What Changed

Preserved user-typed text in the composer when a planning question appears while the user is typing. Previously, the input would be cleared because the sync effect would overwrite it with the empty pending answer.

Why

The sync effect that copies pending user input to the composer was unconditionally overwriting user content. When a planning question pops up, the effect would set the composer value to the empty pending answer, clearing whatever the user had typed. This made for a poor user experience.

The fix adds a check to skip syncing when the user has already typed content in the composer, keeping the pending question input independent from the main composer draft.

Checklist

  • This PR is small and focused
  • I explained what changed and why

Fixes #808

Note

Preserve composer input when a planning question appears in ChatView

Previously, pending question input would overwrite any text the user had already typed in the composer. Now, ChatView.tsx checks promptRef.current.length > 0 before syncing and skips the sync if the user has typed content. For the same (unchanged) question, syncing only happens when the external text has actually changed; new questions still sync to display their placeholder text.

📊 Macroscope summarized b948b8d. 1 file reviewed, 1 issue evaluated, 0 issues filtered, 1 comment posted

🗂️ Filtered Issues

When a planning question pops up while the user is typing in the
composer, their typed text was being cleared. This was caused by
the sync effect that copies pending user input to the composer -
it would overwrite user content with the empty pending answer.

The fix adds a check to skip syncing when the user has already
typed content in the composer, keeping the pending question input
independent from the main composer draft.

Fixes pingdotgg#808
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link

coderabbitai bot commented Mar 14, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 778013cb-6b1f-40e5-a650-4377125d2c4e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

You can customize the high-level summary generated by CodeRabbit.

Configure the reviews.high_level_summary_instructions setting to provide custom instructions for generating the high-level summary.

@github-actions github-actions bot added size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 14, 2026
const textChangedExternally = promptRef.current !== nextCustomAnswer;

lastSyncedPendingInputRef.current = {
requestId: nextRequestId,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 High components/ChatView.tsx:670

When advancing between pending user input questions, if the user typed a custom answer for the previous question, promptRef.current is not synchronized for the new question. The hasUserTypedInComposer check at line 677 returns early whenever promptRef.current.length > 0, regardless of whether questionChanged is true. This leaves promptRef.current stale for the new question, breaking @-mention resolution via applyPromptReplacement and the readComposerSnapshot fallback.

🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file apps/web/src/components/ChatView.tsx around line 670:

When advancing between pending user input questions, if the user typed a custom answer for the previous question, `promptRef.current` is not synchronized for the new question. The `hasUserTypedInComposer` check at line 677 returns early whenever `promptRef.current.length > 0`, regardless of whether `questionChanged` is true. This leaves `promptRef.current` stale for the new question, breaking @-mention resolution via `applyPromptReplacement` and the `readComposerSnapshot` fallback.

Evidence trail:
apps/web/src/components/ChatView.tsx lines 674-700 (REVIEWED_COMMIT): Shows the early return at lines 677-680 (`if (hasUserTypedInComposer) { return; }`) executing BEFORE the `questionChanged` check at line 683. The comment at line 683 states "For new questions (questionChanged), always sync" but this is unreachable when `promptRef.current.length > 0`. Line 2939 of `applyPromptReplacement` uses `promptRef.current` directly. Line 2989 of `readComposerSnapshot` falls back to `promptRef.current`.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix it for me

@Githubguy132010 Githubguy132010 deleted the fix/issue-808-composer-input-reset branch March 14, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Textarea being reset

1 participant