Skip to content

Stop useInfiniteScroll from recreating the IntersectionObserver on every load toggle #898

Description

@RUKAYAT-CODER

Overview
In src/hooks/useInfiniteScroll.ts the observer effect (lines 60-77) includes loading and runLoadMore in its deps, and runLoadMore depends on loading (line 54). Every loading transition disconnects and recreates the IntersectionObserver and re-observes the sentinel, which is wasteful and can miss or duplicate intersection callbacks during rapid scrolling. Read loading from a ref inside the callback and drop it from the deps.

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions