Skip to content

Commit dff750b

Browse files
authored
fix(web): stop question answers from resetting the editor caret (#11337)
1 parent 109aaae commit dff750b

1 file changed

Lines changed: 4 additions & 16 deletions

File tree

‎apps/web/src/components/ChatView.tsx‎

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10428,13 +10428,7 @@ export default function ChatView(props: ChatViewProps) {
1042810428
);
1042910429

1043010430
const onChangeActivePendingUserInputCustomAnswer = useCallback(
10431-
(
10432-
questionId: string,
10433-
value: string,
10434-
nextCursor: number,
10435-
expandedCursor: number,
10436-
_cursorAdjacentToMention: boolean,
10437-
) => {
10431+
(questionId: string, value: string) => {
1043810432
if (!activePendingUserInput) {
1043910433
return;
1044010434
}
@@ -10454,16 +10448,10 @@ export default function ChatView(props: ChatViewProps) {
1045410448
),
1045510449
},
1045610450
}));
10457-
const snapshot = composerRef.current?.readSnapshot();
10458-
if (
10459-
snapshot?.value !== value ||
10460-
snapshot.cursor !== nextCursor ||
10461-
snapshot.expandedCursor !== expandedCursor
10462-
) {
10463-
composerRef.current?.focusAt(nextCursor);
10464-
}
10451+
// The editor owns this selection. Resetting it before the answer renders
10452+
// can re-enter Lexical with offsets from the previous skill token.
1046510453
},
10466-
[activePendingUserInput, activePendingRequestKey, composerRef],
10454+
[activePendingUserInput, activePendingRequestKey],
1046710455
);
1046810456

1046910457
const onAdvanceActivePendingUserInput = useCallback(() => {

0 commit comments

Comments
 (0)