Skip to content

Commit b9afb7b

Browse files
kurokobozxhlyh
andauthored
fix: revert ref usage in handleFormChange to fix IME input issues (#9672)
Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
1 parent b404175 commit b9afb7b

File tree

2 files changed

+6
-4
lines changed
  • web/app/components/base/chat

2 files changed

+6
-4
lines changed

web/app/components/base/chat/chat-with-history/config-panel/form.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useCallback } from 'react'
12
import { useTranslation } from 'react-i18next'
23
import { useChatWithHistoryContext } from '../context'
34
import Input from './form-input'
@@ -15,12 +16,12 @@ const Form = () => {
1516
isMobile,
1617
} = useChatWithHistoryContext()
1718

18-
const handleFormChange = (variable: string, value: any) => {
19+
const handleFormChange = useCallback((variable: string, value: any) => {
1920
handleNewConversationInputsChange({
2021
...newConversationInputsRef.current,
2122
[variable]: value,
2223
})
23-
}
24+
}, [newConversationInputsRef, handleNewConversationInputsChange])
2425

2526
const renderField = (form: any) => {
2627
const {

web/app/components/base/chat/embedded-chatbot/config-panel/form.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useCallback } from 'react'
12
import { useTranslation } from 'react-i18next'
23
import { useEmbeddedChatbotContext } from '../context'
34
import Input from './form-input'
@@ -15,12 +16,12 @@ const Form = () => {
1516
isMobile,
1617
} = useEmbeddedChatbotContext()
1718

18-
const handleFormChange = (variable: string, value: any) => {
19+
const handleFormChange = useCallback((variable: string, value: any) => {
1920
handleNewConversationInputsChange({
2021
...newConversationInputsRef.current,
2122
[variable]: value,
2223
})
23-
}
24+
}, [newConversationInputsRef, handleNewConversationInputsChange])
2425

2526
const renderField = (form: any) => {
2627
const {

0 commit comments

Comments
 (0)