Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(web): keep typed text when a question option is clicked #12577

Mergedcestercian(GitHub profile, opens in a new tab)merged 3 commits intomain fromrefs/pull/12577/headmerged by juliusmarminge View on GitHub

Showing 6 changed files with 58 additions and 8 deletions (loading 3).

x
0 of 6 viewed, 6 left
14 additions and 8 deletionsapps/web/src/components/chat/ChatComposer.tsxModified
View file
@@ -72,6 +72,7 @@
type ComposerSubmissionIntent,
type ComposerTrigger,
collapseExpandedComposerCursor,
+ composerStateAtPromptEnd,
composerSubmissionIntentForEnter,
detectComposerTrigger,
expandCollapsedComposerCursor,
@@ -3080,6 +3081,15 @@
useEffect(() => {
const nextCustomAnswer = activePendingProgress?.customAnswer;
if (typeof nextCustomAnswer !== "string") {
+ // The question is gone and the editor shows the thread draft again. The
+ // ref still holds the last answer text, and Send reads the ref. Place
+ // the caret at the end so the next keystroke appends.
+ if (lastSyncedPendingInputRef.current !== null) {
+ promptRef.current = prompt;
+ const { cursor, trigger } = composerStateAtPromptEnd(prompt);
+ setComposerCursor(cursor);
+ setComposerTrigger(trigger);
+ }
Resolvedby cestercian(GitHub profile, opens in a new tab)
lastSyncedPendingInputRef.current = null;
return;
@@ -3101,19 +3111,15 @@