Skip to content

Commit

Permalink
šŸ› fix: fix input box losing focus after sending a message on the deskā€¦
Browse files Browse the repository at this point in the history
ā€¦top (#830)
  • Loading branch information
mushan0x0 authored Dec 27, 2023
1 parent 7492921 commit d491af9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/features/ChatInput/useChatInput.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { TextAreaRef } from 'antd/es/input/TextArea';
import { useCallback, useRef, useState } from 'react';

import { useIsMobile } from '@/hooks/useIsMobile';
import { useChatStore } from '@/store/chat';
import { useGlobalStore } from '@/store/global';
import { useSessionStore } from '@/store/session';
Expand All @@ -23,12 +24,15 @@ export const useChatInput = () => {
s.updateInputMessage,
s.stopGenerateMessage,
]);
const mobile = useIsMobile();

const handleSend = useCallback(() => {
setExpand(false);
ref?.current?.blur();
if (mobile) {
ref?.current?.blur();
}
onSend();
}, [onSend]);
}, [onSend, mobile]);

return {
canUpload,
Expand Down

0 comments on commit d491af9

Please sign in to comment.