mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-01 20:03:30 +02:00
chore: removed auto-focus implementation
This commit is contained in:
parent
eb70c055a4
commit
2860b789e3
1 changed files with 0 additions and 17 deletions
|
|
@ -409,7 +409,6 @@ const Composer: FC = () => {
|
|||
const setMentionedDocumentIds = useSetAtom(mentionedDocumentIdsAtom);
|
||||
const composerRuntime = useComposerRuntime();
|
||||
const hasAutoFocusedRef = useRef(false);
|
||||
const prevIsThreadEmptyRef = useRef(true);
|
||||
|
||||
// Check if thread is empty (new chat)
|
||||
const isThreadEmpty = useAssistantState(({ thread }) => thread.isEmpty);
|
||||
|
|
@ -429,22 +428,6 @@ const Composer: FC = () => {
|
|||
}
|
||||
}, [isThreadEmpty]);
|
||||
|
||||
// Auto-focus editor immediately after first message is sent (when thread transitions from empty to non-empty)
|
||||
// This allows the user to start typing the second query right away
|
||||
useEffect(() => {
|
||||
// Only focus when transitioning from empty to non-empty (first message sent)
|
||||
if (prevIsThreadEmptyRef.current && !isThreadEmpty && editorRef.current) {
|
||||
// Small delay to ensure the editor is ready after the message is sent
|
||||
const timeoutId = setTimeout(() => {
|
||||
editorRef.current?.focus();
|
||||
}, 50);
|
||||
prevIsThreadEmptyRef.current = isThreadEmpty;
|
||||
return () => clearTimeout(timeoutId);
|
||||
}
|
||||
// Update the ref to track the previous state
|
||||
prevIsThreadEmptyRef.current = isThreadEmpty;
|
||||
}, [isThreadEmpty]);
|
||||
|
||||
// Sync mentioned document IDs to atom for use in chat request
|
||||
useEffect(() => {
|
||||
setMentionedDocumentIds(mentionedDocuments.map((doc) => doc.id));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue