diff --git a/src/renderer/components/dock/pod-logs.tsx b/src/renderer/components/dock/pod-logs.tsx index 5c642974e1..7e64b2cd20 100644 --- a/src/renderer/components/dock/pod-logs.tsx +++ b/src/renderer/components/dock/pod-logs.tsx @@ -14,6 +14,7 @@ import { Button } from "../button"; import { PodLogControls } from "./pod-log-controls"; import { VirtualList } from "../virtual-list"; import { searchStore } from "./search.store"; +import { ListOnScrollProps } from "react-window"; import debounce from "lodash/debounce"; interface Props { @@ -138,10 +139,11 @@ export class PodLogs extends React.Component { return logs; } - onScroll = debounce(() => { + onScroll = debounce((props: ListOnScrollProps) => { const toBottomOffset = 100 * lineHeight; // 100 lines * 18px (height of each line) const { scrollHeight, clientHeight, scrollTop } = this.logsElement.current; - if (scrollTop === 0) { + // Trigger loading only if scrolled by user + if (scrollTop === 0 && !props.scrollUpdateWasRequested) { this.loadMore(); } if (scrollHeight - scrollTop > toBottomOffset) { @@ -150,7 +152,7 @@ export class PodLogs extends React.Component { this.showJumpToBottom = false; } this.lastLineIsShown = clientHeight + scrollTop === scrollHeight; - }, 300); // Debouncing to let virtual list do its internal works + }, 300); // Debouncing to let virtual list do its internal works /** * A function is called by VirtualList for rendering each of the row