fix: revert ref usage in handleFormChange to fix IME input issues (#9672)

Co-authored-by: StyleZhang <jasonapring2015@outlook.com>
This commit is contained in:
kurokobo 2024-10-23 16:47:50 +09:00 committed by GitHub
parent b4041759f7
commit b9afb7bcec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 4 deletions

View File

@ -1,3 +1,4 @@
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { useChatWithHistoryContext } from '../context'
import Input from './form-input'
@ -15,12 +16,12 @@ const Form = () => {
isMobile,
} = useChatWithHistoryContext()
const handleFormChange = (variable: string, value: any) => {
const handleFormChange = useCallback((variable: string, value: any) => {
handleNewConversationInputsChange({
...newConversationInputsRef.current,
[variable]: value,
})
}
}, [newConversationInputsRef, handleNewConversationInputsChange])
const renderField = (form: any) => {
const {

View File

@ -1,3 +1,4 @@
import { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import { useEmbeddedChatbotContext } from '../context'
import Input from './form-input'
@ -15,12 +16,12 @@ const Form = () => {
isMobile,
} = useEmbeddedChatbotContext()
const handleFormChange = (variable: string, value: any) => {
const handleFormChange = useCallback((variable: string, value: any) => {
handleNewConversationInputsChange({
...newConversationInputsRef.current,
[variable]: value,
})
}
}, [newConversationInputsRef, handleNewConversationInputsChange])
const renderField = (form: any) => {
const {