feat: support userInfiniteScroll use forcedLoadMore to keep requestin… - #2640
Open
bbb169 wants to merge 2 commits into
Open
feat: support userInfiniteScroll use forcedLoadMore to keep requestin…#2640bbb169 wants to merge 2 commits into
bbb169 wants to merge 2 commits into
Conversation
…g when data is no more
Collaborator
|
需要补一下文档和单测哈 |
crazylxr
reviewed
Sep 22, 2024
|
|
||
| const loadMore = useMemoizedFn(() => { | ||
| const loadMore = useMemoizedFn((isNeedForcedLoadMore = false) => { | ||
| if (noMore) return; |
Collaborator
There was a problem hiding this comment.
我理解这个好像没那么复杂,不需要写很多复杂的逻辑,其他的逻辑都删掉,直接:
if(!isNeedForcedLoadMore && noMore) {
return;
}
是不是就好了
Author
There was a problem hiding this comment.
我理解这个好像没那么复杂,不需要写很多复杂的逻辑,其他的逻辑都删掉,直接:
if(!isNeedForcedLoadMore && noMore) { return; }是不是就好了
会有问题的,当滚动到下方时,如果不判断
else if (scrollHeight - scrollTop <= clientHeight) { loadMore(true); } 会导致它一直触发loadMore,需要加一层判断来确认是用户主动向下滚动,而不是考虑threshold的距离
Collaborator
There was a problem hiding this comment.
你又改 api 了呀,如果实现 forceLoadMore,从 api 的设计上 我认为在loadMore 的时候增加一个参数,是否忽略 noMore,比增加一个配置更好,逻辑处理也比较简单
function loadMore(ignoreNoMore: bolean) {
}
你看看呢
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…g when data is no more
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
#2180
💡 Background and solution
forcedLoadMore, when this value is set true, user scroll list to bottom will cause request again📝 Changelog
forcedLoadMoreand new returned resulttrulyNoMoreforcedLoadMore和返回结果增加参数trulyNoMore☑️ Self Check before Merge