FIX: knowledge will not render a paginator when count is greater than 30 (#7596)

### What problem does this PR solve?

as https://github.com/infiniflow/ragflow/issues/7538
and https://github.com/infiniflow/ragflow/pull/7550

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu 2025-05-14 11:53:11 +08:00 committed by GitHub
parent 2fa8e3309f
commit d06431f670
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,7 +50,7 @@ const KnowledgeList = () => {
}, [data?.pages]); }, [data?.pages]);
return ( return (
<Flex className={styles.knowledge} vertical flex={1} id="scrollableDiv"> <Flex className={styles.knowledge} vertical flex={1}>
<div className={styles.topWrapper}> <div className={styles.topWrapper}>
<div> <div>
<span className={styles.title}> <span className={styles.title}>
@ -79,33 +79,45 @@ const KnowledgeList = () => {
</Space> </Space>
</div> </div>
<Spin spinning={loading}> <Spin spinning={loading}>
<InfiniteScroll <div
dataLength={nextList?.length ?? 0} id="scrollableDiv"
next={fetchNextPage} style={{
hasMore={hasNextPage} height: 'calc(100vh - 250px)',
loader={<Skeleton avatar paragraph={{ rows: 1 }} active />} overflow: 'auto',
endMessage={!!total && <Divider plain>{t('noMoreData')} 🤐</Divider>} padding: '0 16px',
scrollableTarget="scrollableDiv" }}
> >
<Flex <InfiniteScroll
gap={'large'} dataLength={nextList?.length ?? 0}
wrap="wrap" next={fetchNextPage}
className={styles.knowledgeCardContainer} hasMore={hasNextPage}
loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
endMessage={
!!total && <Divider plain>{t('noMoreData')} 🤐</Divider>
}
scrollableTarget="scrollableDiv"
scrollThreshold="200px"
> >
{nextList?.length > 0 ? ( <Flex
nextList.map((item: any, index: number) => { gap={'large'}
return ( wrap="wrap"
<KnowledgeCard className={styles.knowledgeCardContainer}
item={item} >
key={`${item?.name}-${index}`} {nextList?.length > 0 ? (
></KnowledgeCard> nextList.map((item: any, index: number) => {
); return (
}) <KnowledgeCard
) : ( item={item}
<Empty className={styles.knowledgeEmpty}></Empty> key={`${item?.name}-${index}`}
)} ></KnowledgeCard>
</Flex> );
</InfiniteScroll> })
) : (
<Empty className={styles.knowledgeEmpty}></Empty>
)}
</Flex>
</InfiniteScroll>
</div>
</Spin> </Spin>
<KnowledgeCreatingModal <KnowledgeCreatingModal
loading={creatingLoading} loading={creatingLoading}