Skip to content

Commit 1728ebb

Browse files
shivamhwpjuliusmarminge
authored andcommitted
fix(web): stop question answers from resetting the editor caret
1 parent e74c668 commit 1728ebb

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
@@ -8844,13 +8844,7 @@ export default function ChatView(props: ChatViewProps) {
88448844
);
88458845

88468846
const onChangeActivePendingUserInputCustomAnswer = useCallback(
8847-
(
8848-
questionId: string,
8849-
value: string,
8850-
nextCursor: number,
8851-
expandedCursor: number,
8852-
_cursorAdjacentToMention: boolean,
8853-
) => {
8847+
(questionId: string, value: string) => {
88548848
if (!activePendingUserInput) {
88558849
return;
88568850
}
@@ -8869,16 +8863,10 @@ export default function ChatView(props: ChatViewProps) {
88698863
),
88708864
},
88718865
}));
8872-
const snapshot = composerRef.current?.readSnapshot();
8873-
if (
8874-
snapshot?.value !== value ||
8875-
snapshot.cursor !== nextCursor ||
8876-
snapshot.expandedCursor !== expandedCursor
8877-
) {
8878-
composerRef.current?.focusAt(nextCursor);
8879-
}
8866+
// The editor owns this selection. Resetting it before the answer renders
8867+
// can re-enter Lexical with offsets from the previous skill token.
88808868
},
8881-
[activePendingUserInput, activePendingRequestKey, composerRef],
8869+
[activePendingUserInput, activePendingRequestKey],
88828870
);
88838871

88848872
const onAdvanceActivePendingUserInput = useCallback(() => {

0 commit comments

Comments
 (0)