fix(member-live): stop infinite scroll from cascading into loading every page

This commit is contained in:
Simon 2026-07-16 09:39:14 +02:00
parent f847ae10af
commit f2312c24a1
3 changed files with 14 additions and 12 deletions

View file

@ -41,10 +41,10 @@ defmodule MvWeb.MemberLive.IndexPaginationTest do
assert row_count(html) == @page_limit
# More rows remain, so the infinite-scroll sentinel is armed.
assert html =~ ~s(phx-viewport-bottom="load_more")
assert html =~ ~s(id="members-load-more-sentinel")
end
test "viewport-bottom appends the next page and stops at the last page", %{conn: conn} do
test "the sentinel appends the next page and stops at the last page", %{conn: conn} do
seed_members(@page_limit + 10)
conn = conn_with_oidc_user(conn)
{:ok, view, html} = live(conn, ~p"/members")
@ -56,7 +56,7 @@ defmodule MvWeb.MemberLive.IndexPaginationTest do
assert row_count(html_after) == @page_limit + 10
# Last page reached: the sentinel is disarmed and a further fetch is a no-op.
refute html_after =~ ~s(phx-viewport-bottom="load_more")
refute html_after =~ ~s(id="members-load-more-sentinel")
html_again = render_hook(view, "load_more", %{})
assert row_count(html_again) == @page_limit + 10
end