refactor: replace scroll-sentinel id with lvt-scroll-sentinel attribute#72
refactor: replace scroll-sentinel id with lvt-scroll-sentinel attribute#72
Conversation
…bute Updates the infinite scroll template and E2E tests to use the new lvt-scroll-sentinel boolean attribute instead of the old plain HTML id, aligning with the framework's lvt-* attribute convention. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Code ReviewOverviewThis PR refactors the infinite scroll sentinel from an What's Good
Issues / Concerns1. Hard dependency on an unmerged client release (blocking) The PR description says:
If this is merged before the client library is updated and published to the CDN, every user hitting the production CDN build will get a broken infinite scroll (the IntersectionObserver won't find the sentinel). Consider:
2. Stale The diff only touches three files. If any CSS, documentation, or other templates reference (If the result is clean, add a note to the PR confirming it.) 3. Boolean attribute in the template <div lvt-scroll-sentinel>This is valid HTML5, but some HTML validators and linters flag valueless custom attributes. If the project runs an HTML validator in CI, verify it's happy with this form. An explicit empty-string value ( Minor NitThe description SummaryThe refactor is clean and directionally correct. The only real risk is the client dependency ordering. Resolve that (merge gate or version pin) and confirm no other |
There was a problem hiding this comment.
Pull request overview
Refactors the infinite-scroll “sentinel” hook from a hard-coded id="scroll-sentinel" to a lvt-scroll-sentinel attribute, aligning templates and E2E tests with the updated client behavior.
Changes:
- Updated infinite scroll template to use
<div lvt-scroll-sentinel>(and updated explanatory text). - Updated E2E test selectors from
getElementByIdtoquerySelector('[lvt-scroll-sentinel]'). - Updated handler comment to reflect the new sentinel markup.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| patterns/templates/lists/infinite-scroll.tmpl | Replaces sentinel id usage with lvt-scroll-sentinel attribute in markup and docs text. |
| patterns/patterns_test.go | Updates chromedp JS to locate the sentinel via attribute selector. |
| patterns/handlers_lists.go | Updates comment to match the new sentinel attribute. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
lvt-scroll-sentinelattribute instead ofid="scroll-sentinel"getElementByIdtoquerySelectorDepends on: livetemplate/client#92 (must be merged + published first)
Test plan
TestInfiniteScrollE2E passes with updated client build (all 3 subtests)🤖 Generated with Claude Code