diff --git a/src/renderer/components/dock/logs/log-list.tsx b/src/renderer/components/dock/logs/log-list.tsx index c2a84ce7b0..61d2fa85cd 100644 --- a/src/renderer/components/dock/logs/log-list.tsx +++ b/src/renderer/components/dock/logs/log-list.tsx @@ -32,6 +32,7 @@ export const LogList = observer(({ model }: LogListProps) => { setToBottomVisibility(); setLastLineVisibility(); + checkLoadIntent(); } // TODO: Move to its own hook @@ -55,6 +56,17 @@ export const LogList = observer(({ model }: LogListProps) => { } } + /** + * Check if user scrolled to top and new logs should be loaded + */ + const checkLoadIntent = () => { + const { scrollTop } = parentRef.current as HTMLDivElement; + + if (scrollTop === 0) { + model.loadLogs(); + } + }; + useEffect(() => { setTimeout(() => { // Initial scroll to bottom