Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(web): collapsible question panel in the composer #6588

ClosedPollyGlot(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/6588/headopened View on GitHub

Showing 3 changed files with 84 additions and 3 deletions.

x
0 of 3 viewed, 3 left
20 additions and 3 deletionsapps/web/src/components/chat/ComposerPendingUserInputPanel.tsxModified
View file
@@ -3,6 +3,7 @@
import { type PendingUserInput } from "../../session-logic";
import {
derivePendingUserInputProgress,
+ derivePendingUserInputSelectionEcho,
type PendingUserInputDraftAnswer,
} from "../../pendingUserInput";
import { CheckIcon, ChevronDownIcon } from "lucide-react";
@@ -164,6 +165,13 @@
​
const customAnswerActive = progress.customAnswer.trim().length > 0;
+ // The optimistic selection wins here for the same reason it wins on the option
+ // buttons: the answer round-trips through the server, and the echo would
+ // otherwise blink back to the previous selection for that trip.
+ const selectionEcho =
+ optimisticSingleSelect?.questionId === activeQuestion.id
+ ? optimisticSingleSelect.optionLabel
+ : derivePendingUserInputSelectionEcho(activeQuestion, progress.activeDraft);
​
return (
<Collapsible
@@ -197,10 +205,19 @@
) : null}
{/* Collapsed, the header is otherwise just a section label and a
counter, so the question itself is echoed here as a one-line
- reminder of what is being asked. */}
+ reminder of what is being asked, followed by the current answer so