From 2e2454e12dca3decb1c517f9c18feef63f616991 Mon Sep 17 00:00:00 2001 From: H0llyW00dzZ Date: Sat, 10 Feb 2024 18:27:29 +0700 Subject: [PATCH] Fix [UI/UX] [Front End] Stupid complexity react warning (#270) - [+] fix(chat.tsx): add config.autoScrollMessage to useEffect dependencies to eliminate react warning --- app/components/chat.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/components/chat.tsx b/app/components/chat.tsx index 21bb0b21172..9f339e5eaf3 100644 --- a/app/components/chat.tsx +++ b/app/components/chat.tsx @@ -1193,7 +1193,14 @@ function _Chat() { setHitBottom(isHitBottom); let isAutoScrollEnabled: boolean = config.autoScrollMessage; setAutoScroll(isAutoScrollEnabled); - }, [setHitBottom, setAutoScroll, isMobileScreen, msgRenderIndex, setMsgRenderIndex]); // Added setMsgRenderIndex + }, [ + setHitBottom, + setAutoScroll, + isMobileScreen, + msgRenderIndex, + setMsgRenderIndex, // Added setMsgRenderIndex + config.autoScrollMessage // Include this dependency as indicated by the stupid complexity react warning + ]); // Use the custom hook to debounce the onChatBodyScroll function useDebouncedEffect(() => {