From dbf25cef88abba7d690405003aabb40ce3bacd28 Mon Sep 17 00:00:00 2001 From: heheer Date: Wed, 5 Mar 2025 14:08:38 +0800 Subject: [PATCH] fix ai proxy logs pagination (#3954) * fix ai proxy logs pagination * delete unused code --- packages/web/hooks/useScrollPagination.tsx | 7 ++++++- .../app/src/pageComponents/account/model/Log/index.tsx | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/web/hooks/useScrollPagination.tsx b/packages/web/hooks/useScrollPagination.tsx index a326a20b7..9b90f5eeb 100644 --- a/packages/web/hooks/useScrollPagination.tsx +++ b/packages/web/hooks/useScrollPagination.tsx @@ -214,6 +214,11 @@ export function useScrollPagination< async (init = false, ScrollContainerRef?: RefObject) => { if (noMore && !init) return; + if (init) { + setData([]); + setTotal(0); + } + const offset = init ? 0 : data.length; setTrue(); @@ -288,7 +293,7 @@ export function useScrollPagination< // Watch scroll position useThrottleEffect( () => { - if (!ref?.current || noMore) return; + if (!ref?.current || noMore || isLoading || data.length === 0) return; const { scrollTop, scrollHeight, clientHeight } = ref.current; if ( diff --git a/projects/app/src/pageComponents/account/model/Log/index.tsx b/projects/app/src/pageComponents/account/model/Log/index.tsx index 7b65f435b..e2320b0ea 100644 --- a/projects/app/src/pageComponents/account/model/Log/index.tsx +++ b/projects/app/src/pageComponents/account/model/Log/index.tsx @@ -255,8 +255,8 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => { - {formatData.map((item) => ( - + {formatData.map((item, index) => ( + {item.channelName} {item.model}