Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: content和totalPages的某些组合会导致无限loading #81

Merged
merged 3 commits into from
Oct 21, 2019

Conversation

donaldshen
Copy link
Contributor

@donaldshen donaldshen commented Oct 21, 2019

Why

fix #80
之前处理content.length === 0 && totalPages === 0这个组合时处理不当,导致无限loading

How

梳理complete的逻辑判断。现在以下几个场景,data-list会判断状态为complete(无需再请求数据)

  1. 请求完数据为空(首屏数据为空,直接就complete)
  2. 请求完有数据,但没有totalPages(无法判断还有多少页,只能立即complete)
  3. 请求完有数据,但page越界nextPage > totalPages || prevPage < defaultFirstPage(data-list有默认的page边界判断,需要接口也遵守约定)

Test

在项目中测试,首屏接口返回content.length === 0 && totalPages === 0时,能够正常显示没有数据的结果
image

@auto-add-label auto-add-label bot added the bug Something isn't working label Oct 21, 2019
@netlify
Copy link

netlify bot commented Oct 21, 2019

Deploy preview for data-list ready!

Built with commit 09d7635

https://deploy-preview-81--data-list.netlify.com

@levy9527 levy9527 merged commit 0bd8fc8 into FEMessage:dev Oct 21, 2019
@donaldshen donaldshen deleted the fix/loading branch October 21, 2019 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keep loading even API callback empty content
4 participants