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(useInfiniteScroll): reload data should be latest #2124

Merged
merged 3 commits into from Mar 23, 2023

Conversation

hchlq
Copy link
Collaborator

@hchlq hchlq commented Mar 17, 2023

[中文版模板 / Chinese template]

🤔 This is a bugFix

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

close #1970

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@liuyib liuyib changed the title reload data should be latest fix(useInfiniteScroll): reload data should be latest Mar 21, 2023
@@ -159,6 +159,35 @@ describe('useInfiniteScroll', () => {
});
});

it('reload data should be latest', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

试了下这个 test 不改也能过

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里主要测试的是最终结果没问题,那个结果态还不太好 mock

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@miracles1919 我试了下 cross-env REACT_MODE=strict jest packages/hooks/src/useInfiniteScroll/__tests__/index.test.ts 执行时,我特定写了个 useEffect,好像只运行一次,符合预期么

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我知道了,引用的 renderHook 还是之前的,strict 模式要从 utils 引入,应该是之前 strict 问题比较多,所以没改

@crazylxr crazylxr merged commit 7aca7db into alibaba:master Mar 23, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: useInfiniteScroll在reload时数据混乱问题
3 participants