From 191e6f9714ecf5e46d0bf40e7c57bb31f17fd802 Mon Sep 17 00:00:00 2001 From: Dinh Long Nguyen Date: Tue, 30 Sep 2025 22:24:31 +0700 Subject: [PATCH] fix lint issue --- web-app/src/containers/RenderMarkdown.tsx | 1 - web-app/src/hooks/useChat.ts | 2 +- web-app/src/hooks/useThreadScrolling.tsx | 12 ++++++------ web-app/src/routes/threads/$threadId.tsx | 6 +----- 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/web-app/src/containers/RenderMarkdown.tsx b/web-app/src/containers/RenderMarkdown.tsx index 31d08cf10..c941b512d 100644 --- a/web-app/src/containers/RenderMarkdown.tsx +++ b/web-app/src/containers/RenderMarkdown.tsx @@ -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' diff --git a/web-app/src/hooks/useChat.ts b/web-app/src/hooks/useChat.ts index 357fc3a8d..935458326 100644 --- a/web-app/src/hooks/useChat.ts +++ b/web-app/src/hooks/useChat.ts @@ -131,7 +131,7 @@ export const useChat = () => { }) } return currentThread - }, [createThread, retrieveThread, router]) + }, [createThread, retrieveThread, router, setMessages]) const restartModel = useCallback( async (provider: ProviderObject, modelId: string) => { diff --git a/web-app/src/hooks/useThreadScrolling.tsx b/web-app/src/hooks/useThreadScrolling.tsx index 41362db61..a3c6d7ed2 100644 --- a/web-app/src/hooks/useThreadScrolling.tsx +++ b/web-app/src/hooks/useThreadScrolling.tsx @@ -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( () => ({ diff --git a/web-app/src/routes/threads/$threadId.tsx b/web-app/src/routes/threads/$threadId.tsx index adfa8b140..a10c96ede 100644 --- a/web-app/src/routes/threads/$threadId.tsx +++ b/web-app/src/routes/threads/$threadId.tsx @@ -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(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)