fix lint issue

This commit is contained in:
Dinh Long Nguyen 2025-09-30 22:24:31 +07:00
parent e6bc1182a6
commit 191e6f9714
4 changed files with 8 additions and 13 deletions

View File

@ -1,4 +1,3 @@
/* eslint-disable react-hooks/exhaustive-deps */
import ReactMarkdown, { Components } from 'react-markdown'
import remarkGfm from 'remark-gfm'
import remarkEmoji from 'remark-emoji'

View File

@ -131,7 +131,7 @@ export const useChat = () => {
})
}
return currentThread
}, [createThread, retrieveThread, router])
}, [createThread, retrieveThread, router, setMessages])
const restartModel = useCallback(
async (provider: ProviderObject, modelId: string) => {

View File

@ -78,7 +78,7 @@ export const useThreadScrolling = (
return () =>
scrollContainer.removeEventListener('scroll', handleScroll)
}
}, [handleScroll])
}, [handleScroll, scrollContainerRef])
const checkScrollState = useCallback(() => {
const scrollContainer = scrollContainerRef.current
@ -90,7 +90,7 @@ export const useThreadScrolling = (
setIsAtBottom(isBottom)
setHasScrollbar(hasScroll)
}, [])
}, [scrollContainerRef])
useEffect(() => {
if (!scrollContainerRef.current) return
@ -101,7 +101,7 @@ export const useThreadScrolling = (
scrollToBottom(false)
checkScrollState()
}
}, [checkScrollState, scrollToBottom])
}, [checkScrollState, scrollToBottom, scrollContainerRef])
const prevCountRef = useRef(messageCount)
@ -146,7 +146,7 @@ export const useThreadScrolling = (
}
prevCountRef.current = messageCount
}, [messageCount, lastMessageRole])
}, [messageCount, lastMessageRole, getDOMElements, setPaddingHeight])
useEffect(() => {
const previouslyStreaming = wasStreamingRef.current
@ -197,7 +197,7 @@ export const useThreadScrolling = (
}
wasStreamingRef.current = currentlyStreaming
}, [streamingContent, threadId])
}, [streamingContent, threadId, getDOMElements, setPaddingHeight])
useEffect(() => {
userIntendedPositionRef.current = null
@ -207,7 +207,7 @@ export const useThreadScrolling = (
prevCountRef.current = messageCount
scrollToBottom(false)
checkScrollState()
}, [threadId])
}, [threadId, messageCount, scrollToBottom, checkScrollState, setPaddingHeight])
return useMemo(
() => ({

View File

@ -25,7 +25,6 @@ import ScrollToBottom from '@/containers/ScrollToBottom'
import { PromptProgress } from '@/components/PromptProgress'
import { ThreadPadding } from '@/containers/ThreadPadding'
import { TEMPORARY_CHAT_ID, TEMPORARY_CHAT_QUERY_ID } from '@/constants/chat'
import { useThreadScrolling } from '@/hooks/useThreadScrolling'
import { IconInfoCircle } from '@tabler/icons-react'
import { Tooltip, TooltipContent, TooltipTrigger } from '@/components/ui/tooltip'
@ -100,9 +99,6 @@ function ThreadDetail() {
const scrollContainerRef = useRef<HTMLDivElement>(null)
// Get padding height for ChatGPT-style message positioning
const { paddingHeight } = useThreadScrolling(threadId, scrollContainerRef)
// Listen for conversation not found events
useEffect(() => {
const handleConversationNotFound = (event: CustomEvent) => {
@ -124,7 +120,7 @@ function ThreadDetail() {
return () => {
window.removeEventListener(CONVERSATION_NOT_FOUND_EVENT, handleConversationNotFound as EventListener)
}
}, [threadId, navigate])
}, [threadId, navigate, t])
useEffect(() => {
setCurrentThreadId(threadId)