Skip to content

Refactor useInfiniteScroll: remove cancelled flag and simplify fetch handling#21

Merged
pedrokarim merged 1 commit intomainfrom
dev
Mar 15, 2026
Merged

Refactor useInfiniteScroll: remove cancelled flag and simplify fetch handling#21
pedrokarim merged 1 commit intomainfrom
dev

Conversation

@pedrokarim
Copy link
Owner

This pull request simplifies the cleanup logic in the useInfiniteScroll hook by removing the unnecessary cancelled flag and its associated cleanup function. Instead, it relies solely on the fetchGenRef generation check to prevent state updates from outdated fetches.

Improvements to infinite scroll cleanup logic:

  • Removed the cancelled flag and cleanup function from the effect, streamlining the logic and reducing potential sources of bugs. Now, only the fetchGenRef generation check is used to prevent state updates from stale fetches. (hooks/use-infinite-scroll.ts) [1] [2]

@pedrokarim pedrokarim merged commit dab1220 into main Mar 15, 2026
1 check 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.

1 participant