Skip to content

Conversation

@bowencool
Copy link
Contributor

[中文版模板 / Chinese template]

🤔 This is a ...

  • 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

💡 Background and solution

Before: onSuccess() -> setFinalData() and scrollMethod() -> loadMore() -> finalData.
After: onSuccess() -> setFinalData(), useEffect() -> scrollMethod() -> loadMore() -> finalData

The scrollMethod() -> loadMore() -> finalData is within the closure of the old flow, causing loadMore() to access the old state.

📝 Changelog

Language Changelog
🇺🇸 English Fix closure issue (cannot access the latest data during the first loadMore())
🇨🇳 Chinese 修复闭包问题(第一次 loadMore() 时无法访问最新数据)

☑️ 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

@bowencool bowencool marked this pull request as draft January 23, 2026 08:38
@bowencool bowencool marked this pull request as ready for review January 23, 2026 08:39
@bowencool bowencool changed the title fix closure issue fix: closure issue Jan 23, 2026
@bowencool bowencool changed the title fix: closure issue fix(useInfiniteScroll): Closure issue preventing access to the latest data during the initial loadMore() call Jan 23, 2026
@pkg-pr-new
Copy link

pkg-pr-new bot commented Jan 23, 2026

npm i https://pkg.pr.new/ahooks@2896
npm i https://pkg.pr.new/@ahooksjs/use-url-state@2896

commit: 7947cfe

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