Skip to content

fix(useInfiniteScroll): update noMore when its predicate changes - #2999

Open
Aminark wants to merge 2 commits into
alibaba:masterfrom
Aminark:fix/infinite-scroll-no-more-update
Open

Aminark wants to merge 2 commits into
alibaba:masterfrom
Aminark:fix/infinite-scroll-no-more-update

Conversation

@Aminark

@Aminark Aminark commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

🤔 This is a ...

  • Bug fix

🔗 Related issue link

Reproduced on the current master branch; regression tests are included.

💡 Background and solution

noMore only updates when accumulated data changes. If isNoMore captures an external total, changing that total leaves the old result cached: increasing the total can permanently block loadMore, while decreasing it allows an unnecessary request. Adding or removing the predicate also leaves stale state.

Include isNoMore in the memo dependencies so a changed predicate is evaluated against the existing data.

Validation: all three new regression tests fail before the fix. The complete useInfiniteScroll suite passes after the fix (43 tests), and tsc --noEmit passes.

📝 Changelog

Language Changelog
🇺🇸 English Fix useInfiniteScroll retaining an outdated noMore value when isNoMore changes.
🇨🇳 Chinese 修复 useInfiniteScroll 在 isNoMore 变化后仍保留过期 noMore 状态的问题。

☑️ Self Check before Merge

  • 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

@pkg-pr-new

pkg-pr-new Bot commented Oct 29, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ahooks@2999
npm i https://pkg.pr.new/@ahooks.js/use-url-state@2999

commit: d809ad6

This branch has not been deployed

No deployments
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.

1 participant