Fix: InfiniteScroll sometimes can not fetch next page (#7550)

### What problem does this PR solve?

https://github.com/infiniflow/ragflow/issues/7538

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu 2025-05-12 17:15:55 +08:00 committed by GitHub
parent 514c08a932
commit 4a891f2d67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,24 +70,39 @@ const FlowList = () => {
</Flex> </Flex>
<Spin spinning={loading}> <Spin spinning={loading}>
<InfiniteScroll <div
dataLength={nextList?.length ?? 0} id="scrollableDiv"
next={fetchNextPage} style={{
hasMore={hasNextPage} height: 'calc(100vh - 200px)',
loader={<Skeleton avatar paragraph={{ rows: 1 }} active />} overflow: 'auto',
endMessage={!!total && <Divider plain>{t('noMoreData')} 🤐</Divider>} }}
scrollableTarget="scrollableDiv"
> >
<Flex gap={'large'} wrap="wrap" className={styles.flowCardContainer}> <InfiniteScroll
{nextList.length > 0 ? ( dataLength={nextList?.length ?? 0}
nextList.map((item) => { next={fetchNextPage}
return <FlowCard item={item} key={item.id}></FlowCard>; hasMore={hasNextPage}
}) loader={<Skeleton avatar paragraph={{ rows: 1 }} active />}
) : ( endMessage={
<Empty className={styles.knowledgeEmpty}></Empty> !!total && <Divider plain>{t('noMoreData')} 🤐</Divider>
)} }
</Flex> scrollableTarget="scrollableDiv"
</InfiniteScroll> scrollThreshold="200px"
>
<Flex
gap={'large'}
wrap="wrap"
className={styles.flowCardContainer}
>
{nextList.length > 0 ? (
nextList.map((item) => {
return <FlowCard item={item} key={item.id}></FlowCard>;
})
) : (
<Empty className={styles.knowledgeEmpty}></Empty>
)}
</Flex>
</InfiniteScroll>
</div>
</Spin> </Spin>
{flowSettingVisible && ( {flowSettingVisible && (
<AgentTemplateModal <AgentTemplateModal