fix: set last page after loading all logs

This commit is contained in:
jialin
2025-01-12 20:01:27 +08:00
parent 0de0426f72
commit d099a22bd9
@@ -50,7 +50,6 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
pos: 'bottom', pos: 'bottom',
page: 1 page: 1
}); });
const dataLengthRef = useRef(0);
const lineCountRef = useRef(0); const lineCountRef = useRef(0);
useImperativeHandle(ref, () => ({ useImperativeHandle(ref, () => ({
@@ -251,7 +250,12 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
); );
setLogs(result); setLogs(result);
setTotalPage(totalPageRef.current); setTotalPage(totalPageRef.current);
setPage(pageRef.current); if (isLoadingMoreRef.current) {
setPage(totalPageRef.current);
pageRef.current = totalPageRef.current;
} else {
setPage(pageRef.current);
}
setCurrentData(currentLogs); setCurrentData(currentLogs);
debounceLoading(); debounceLoading();
}; };