Fix duplicate state declaration in embedded chatbot hooks

Removed a duplicate declaration of the userSelectedConversation state in hooks.tsx to prevent potential state inconsistencies. Also made a minor formatting fix in the migration script for consistency.
pull/22059/head
Kalo Chin 11 months ago
parent 9c493a90e4
commit 35c8bd88c7

@ -1,7 +1,7 @@
"""add always_new_chat boolean field to apps and sites (default true)
Revision ID: 0001_add_always_new_chat
Revises:
Revises:
Create Date: 2025-07-08 00:00:00.000000
"""
@ -21,4 +21,4 @@ def upgrade():
def downgrade():
for table in ('apps', 'sites'):
op.drop_column(table, 'always_new_chat')
op.drop_column(table, 'always_new_chat')

@ -120,6 +120,7 @@ export const useEmbeddedChatbot = () => {
defaultValue: {},
})
const allowResetChat = !conversationId
const [userSelectedConversation, setUserSelectedConversation] = useState(false)
const currentConversationId = useMemo(() => {
if (appData?.site?.always_new_chat && !userSelectedConversation)
return ''
@ -164,8 +165,6 @@ export const useEmbeddedChatbot = () => {
)
const [showNewConversationItemInList, setShowNewConversationItemInList] = useState(false)
const [userSelectedConversation, setUserSelectedConversation] = useState(false)
const pinnedConversationList = useMemo(() => {
return appPinnedConversationData?.data || []
}, [appPinnedConversationData])

Loading…
Cancel
Save