Skip to content

Fix infinite scroll sentinel not observed when hasMore is initially false#12

Merged
phulin merged 1 commit into
phulin:mainfrom
jhurwitz:infinite-scroll
May 15, 2026
Merged

Fix infinite scroll sentinel not observed when hasMore is initially false#12
phulin merged 1 commit into
phulin:mainfrom
jhurwitz:infinite-scroll

Conversation

@jhurwitz
Copy link
Copy Markdown
Contributor

Summary

  • The IntersectionObserver was set up once in onMount, but the sentinel element is only rendered when hasMore() is true (inside a <Show>). If hasMore() was false at mount time, the sentinel was never in the DOM and the observer never attached.
  • Fixed by making sentinel a signal and using createEffect to create and observe a fresh IntersectionObserver whenever the sentinel mounts.

🤖 Generated with Claude Code

…ally false

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@phulin phulin merged commit daebd29 into phulin:main May 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.

2 participants