Page size dropdown on /review page does nothing #78

Closed
opened 2026-08-03 23:40:43 +00:00 by agent-pi · 2 comments
Collaborator

The per-page dropdown at the bottom of the /review LiveView page has no effect when changed. Selecting a different value does not reload the page with the new number of posts.

Cause

The element in ReviewLiveView._render_table_footer() (liveviews.py line 1400) lacks a name attribute. Without name="value", the browser does not include the select value in the form data sent with the phx-change event. The handler handle_set_page_size reads payload.get("value", 20), which always falls back to the default 20.

Fix

Add name="value" to the

element.

The per-page dropdown at the bottom of the /review LiveView page has no effect when changed. Selecting a different value does not reload the page with the new number of posts. ## Cause The <select> element in ReviewLiveView._render_table_footer() (liveviews.py line 1400) lacks a name attribute. Without name="value", the browser does not include the select value in the form data sent with the phx-change event. The handler handle_set_page_size reads payload.get("value", 20), which always falls back to the default 20. ## Fix Add name="value" to the <select> element.
Author
Collaborator

The fix is a single attribute addition in liveviews.py line 1400: add name="value" to the <select> element in _render_table_footer().

Plan

  1. Branch: fix/issue-78-page-size-dropdown
  2. One commit: add name="value" to the select
  3. PR targeting main
The fix is a single attribute addition in liveviews.py line 1400: add `name="value"` to the `<select>` element in `_render_table_footer()`. ## Plan 1. Branch: `fix/issue-78-page-size-dropdown` 2. One commit: add `name="value"` to the select 3. PR targeting `main`
Author
Collaborator

Root cause found — the previous fixes were all server-side, but the event never reaches the server.

The page-size select had phx-change="set_page_size" but no ancestor

. In the LiveView JS (app.js pushInput), a change on an input with its own phx-change calls serializeForm(inputEl.form, ...) → new FormData(null), which throws a TypeError in the browser. The push is aborted before any websocket frame is sent, so handle_set_page_size never ran: no re-render, and page_size stayed 20 for next_page navigation.

Fix: wrap the select in (commit 34c9619), matching how the working filter form operates. The server-side handler from the previous commits (name="value", parse_qs list handling) is correct and now actually gets exercised. Added a render test asserting the select is inside the form.

Root cause found — the previous fixes were all server-side, but the event never reaches the server. The page-size select had phx-change="set_page_size" but no ancestor <form>. In the LiveView JS (app.js pushInput), a change on an input with its own phx-change calls serializeForm(inputEl.form, ...) → new FormData(null), which throws a TypeError in the browser. The push is aborted before any websocket frame is sent, so handle_set_page_size never ran: no re-render, and page_size stayed 20 for next_page navigation. Fix: wrap the select in <form phx-change="set_page_size"> (commit 34c9619), matching how the working filter form operates. The server-side handler from the previous commits (name="value", parse_qs list handling) is correct and now actually gets exercised. Added a render test asserting the select is inside the form.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
marvin8/dujiangyan#78
No description provided.