Skip to content
TypeScript

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

shivamdff750b1b881
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index dd66b021d1e..3d5bbe7236d 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -10428,13 +10428,7 @@ export default function ChatView(props: ChatViewProps) {
);
const onChangeActivePendingUserInputCustomAnswer = useCallback(
- (
- questionId: string,
- value: string,
- nextCursor: number,
- expandedCursor: number,
- _cursorAdjacentToMention: boolean,
- ) => {
+ (questionId: string, value: string) => {
if (!activePendingUserInput) {
return;
}
@@ -10454,16 +10448,10 @@ export default function ChatView(props: ChatViewProps) {
),
},
}));
- const snapshot = composerRef.current?.readSnapshot();
- if (
- snapshot?.value !== value ||
- snapshot.cursor !== nextCursor ||
- snapshot.expandedCursor !== expandedCursor
- ) {
- composerRef.current?.focusAt(nextCursor);
- }
+ // The editor owns this selection. Resetting it before the answer renders
+ // can re-enter Lexical with offsets from the previous skill token.
},
- [activePendingUserInput, activePendingRequestKey, composerRef],
+ [activePendingUserInput, activePendingRequestKey],
);
const onAdvanceActivePendingUserInput = useCallback(() => {