From d099a22bd9658e1ad1736e35d10c5f844216660f Mon Sep 17 00:00:00 2001 From: jialin Date: Sun, 12 Jan 2025 20:01:27 +0800 Subject: [PATCH] fix: set last page after loading all logs --- src/components/logs-viewer/virtual-log-list.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/logs-viewer/virtual-log-list.tsx b/src/components/logs-viewer/virtual-log-list.tsx index 8ffa9583..385670af 100644 --- a/src/components/logs-viewer/virtual-log-list.tsx +++ b/src/components/logs-viewer/virtual-log-list.tsx @@ -50,7 +50,6 @@ const LogsViewer: React.FC = forwardRef((props, ref) => { pos: 'bottom', page: 1 }); - const dataLengthRef = useRef(0); const lineCountRef = useRef(0); useImperativeHandle(ref, () => ({ @@ -251,7 +250,12 @@ const LogsViewer: React.FC = forwardRef((props, ref) => { ); setLogs(result); setTotalPage(totalPageRef.current); - setPage(pageRef.current); + if (isLoadingMoreRef.current) { + setPage(totalPageRef.current); + pageRef.current = totalPageRef.current; + } else { + setPage(pageRef.current); + } setCurrentData(currentLogs); debounceLoading(); };