Remove redundant interval in ChatPanel

- Removed the interval that was set to fetch settings every 3 seconds in ChatPanel.tsx.
- This interval was unnecessary and has been removed to improve performance.
- Also, cleaned up the useEffect hook by removing the interval start and stop calls.
This commit is contained in:
Rankin Zheng 2023-08-24 19:40:07 +08:00
parent 4575798645
commit 38a685edb2

View File

@ -49,10 +49,6 @@ const chatPanel = observer(() => {
} }
}, 1000); }, 1000);
const interval = useInterval(() => {
getSettings();
}, 3000);
const onScrollPositionChange = ({ x, y }) => { const onScrollPositionChange = ({ x, y }) => {
const sh = scrollViewport.current?.scrollHeight || 0; const sh = scrollViewport.current?.scrollHeight || 0;
const vh = scrollViewport.current?.clientHeight || 0; const vh = scrollViewport.current?.clientHeight || 0;
@ -107,10 +103,8 @@ const chatPanel = observer(() => {
timer.start(); timer.start();
interval.start();
return () => { return () => {
timer.clear(); timer.clear();
interval.stop();
}; };
}, []); }, []);
@ -129,6 +123,7 @@ const chatPanel = observer(() => {
color: 'var(--vscode-editor-foreground)', color: 'var(--vscode-editor-foreground)',
minWidth: 240 minWidth: 240
}}> }}>
{!chat.isBottom && <ActionIcon {!chat.isBottom && <ActionIcon
onClick={() => { scrollToBottom() }} onClick={() => { scrollToBottom() }}
title='Bottom' title='Bottom'