mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Load more logs when scrolled to top
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
85fadc74e0
commit
88678f63a2
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user