fix: model logs loading

This commit is contained in:
jialin
2024-11-29 13:41:28 +08:00
parent 890287ce72
commit 435161854c
13 changed files with 104 additions and 26 deletions
@@ -86,7 +86,9 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
const getLastPage = useCallback(
(data: string) => {
const list = _.split(data.trim(), '\n');
console.log('list.length', list.length);
if (!enableScorllLoad) {
return list.join('\n');
}
if (list.length <= pageSize) {
setTotalPage(1);
@@ -101,7 +103,7 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
debounceLoading();
return lastPage;
},
[pageSize, setTotalPage, setPage, debounceLoading]
[pageSize, setTotalPage, setPage, debounceLoading, enableScorllLoad]
);
const getPrePage = useCallback(() => {
@@ -179,7 +181,7 @@ const LogsViewer: React.FC<LogsViewerProps> = forwardRef((props, ref) => {
setIsLoadend(true);
}
},
[loading, isLoadend, logs.length, pageSize]
[loading, isLoadend, logs.length, pageSize, enableScorllLoad]
);
const debouncedScroll = useCallback(