mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix scroll position when more logs loaded
Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
parent
6d0d524f4f
commit
968621f7c6
@ -62,19 +62,14 @@ export const LogList = observer(({ model }: LogListProps) => {
|
||||
const { scrollTop } = parentRef.current as HTMLDivElement;
|
||||
|
||||
if (scrollTop === 0) {
|
||||
const oldLogsAmount = visibleLogs.get().length;
|
||||
const logs = model.logs.get();
|
||||
const firstLog = logs[0];
|
||||
|
||||
await model.loadLogs();
|
||||
const newLogsAmount = visibleLogs.get().length;
|
||||
|
||||
|
||||
const scrollToIndex = newLogsAmount - oldLogsAmount;
|
||||
console.log("new logs loaded", oldLogsAmount, newLogsAmount, scrollToIndex);
|
||||
const scrollToIndex = model.logs.get().findIndex(log => log === firstLog);
|
||||
|
||||
setTimeout(() => {
|
||||
rowVirtualizer.scrollToIndex(scrollToIndex, { align: 'start', smoothScroll: false });
|
||||
}, 1000)
|
||||
|
||||
// rowVirtualizer.scrollToIndex(scrollToIndex, { align: 'start', smoothScroll: false });
|
||||
rowVirtualizer.scrollToIndex(scrollToIndex, { align: 'start', smoothScroll: false });
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user