authorgravatar for 91240327+shivamhwp@users.noreply.github.comshivam <91240327+shivamhwp@users.noreply.github.com> 2026-10-14 07:32:13+05:30
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-14 07:32:13+05:30
logdff750b1b8818eb004b8c3d060edcdc09f88a07f
tree79122d72f070797991860551f4e930a0b0289917
parent109aaae6cd251e1d3aa595624209758a164d8b33
signature Signed by PGP key B5690EEEBB952194

fix(web): stop question answers from resetting the editor caret (#11337)


1 files changed, 4 insertions(+), 16 deletions(-)

apps/web/src/components/ChatView.tsx+4-16
...@@ -10428,13 +10428,7 @@ export default function ChatView(props: ChatViewProps) {...@@ -10428,13 +10428,7 @@ export default function ChatView(props: ChatViewProps) {
10428 );10428 );
1042910429
10430 const onChangeActivePendingUserInputCustomAnswer = useCallback(10430 const onChangeActivePendingUserInputCustomAnswer = useCallback(
10431 (10431 (questionId: string, value: string) => {
10432 questionId: string,
10433 value: string,
10434 nextCursor: number,
10435 expandedCursor: number,
10436 _cursorAdjacentToMention: boolean,
10437 ) => {
10438 if (!activePendingUserInput) {10432 if (!activePendingUserInput) {
10439 return;10433 return;
10440 }10434 }
...@@ -10454,16 +10448,10 @@ export default function ChatView(props: ChatViewProps) {...@@ -10454,16 +10448,10 @@ export default function ChatView(props: ChatViewProps) {
10454 ),10448 ),
10455 },10449 },
10456 }));10450 }));
10457 const snapshot = composerRef.current?.readSnapshot();10451 // The editor owns this selection. Resetting it before the answer renders
10458 if (10452 // can re-enter Lexical with offsets from the previous skill token.
10459 snapshot?.value !== value ||
10460 snapshot.cursor !== nextCursor ||
10461 snapshot.expandedCursor !== expandedCursor
10462 ) {
10463 composerRef.current?.focusAt(nextCursor);
10464 }
10465 },10453 },
10466 [activePendingUserInput, activePendingRequestKey, composerRef],10454 [activePendingUserInput, activePendingRequestKey],
10467 );10455 );
1046810456
10469 const onAdvanceActivePendingUserInput = useCallback(() => {10457 const onAdvanceActivePendingUserInput = useCallback(() => {