Pagy 43 ignores the repo's `Pagy::OPTIONS` initializer; out-of-range pages render empty
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start by reading config/initializers/pagy.rb and Pagy::Offset in the installed Pagy 43.6.2 source, then inspect the shared controller concern if the behavior is changed. First record whether stale pages remain empty, are clamped, or return 404; done means the decision is documented, dead options are removed, and shared behavior has specs if it changes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
Two related problems, both rooted in the pagy 6.4.3 → 43.2.2 jump (commit 6bf5b912):
config/initializers/pagy.rbsetsPagy::OPTIONS[:size]andPagy::OPTIONS[:overflow]. Pagy 43 reads neither —Pagy::OPTIONSis an empty hash that nothing consumes these keys from — so both lines are dead config.- Requesting an out-of-range
?page=on any paginated page renders an empty listing labelled with the full total (e.g. "700 workshops" over an empty table). In Pagy 43 this behaviour is hard-wired:Pagy::Offset#initializecallsassign_empty_page_variablesfor any page past the last, with nooverflowoption, noOverflowError, and no:last_page/:exceptionmodes anywhere in the gem. The series nav still renders, with prev pointing at the last real page.
This manifests on every pagy page in the app: the admin pages (feedback, members, groups, sponsors, invitation logs, admin chapter workshops index) and /coaches.
Context
Raised as a review finding on PR #2915 ("stale/out-of-range ?page= then count-labeled empty table") and deferred there because the behaviour is shared by every paginated page. The finding's original suggested fix — passing overflow: :last_page per call — is not possible on Pagy 43: the option no longer exists, so it would be another silent no-op. Verified against the installed pagy 43.6.2 source.
Related: #2916 (stale items: keywords — same upgrade missed the same breaking changes).
Options
- Accept the hard-wired empty-page behaviour. Delete the dead initializer lines (or the file if nothing else remains) and document the behaviour. No code path changes; users landing on a stale page see an empty table with a correct total and a working nav back.
- Clamp out-of-range pages to the last real page. Pagy 43 offers no lever, so this means resolving the page param against the real page count before building the pagy object — an extra count query per request, in one shared place (a controller concern), not per page.
- Render a 404 for out-of-range pages. Same clamping requirement, plus deciding which routes deserve it. Strictest, most infrastructure.
Option 1 is the default if nobody feels the behaviour is worth the extra query or plumbing; options 2 and 3 exist so the decision is explicit rather than inherited from a dead config line.
Acceptance criteria
- A decision on out-of-range behaviour is recorded
- Dead
Pagy::OPTIONS[:overflow]/[:size]lines removed fromconfig/initializers/pagy.rb(verify:ast-grep run --pattern 'Pagy::OPTIONS[$K] = $V' --lang rubyreturns no output, or the initializer is deleted) - If the behaviour changes, it changes in one shared place with specs pinning it — not per-page
- Ngôn ngữ chính
- Ruby
- Star
- 104
- Fork
- 205
- Merge trung bình
- 1 ngày 6 giờ
- Pull request đã merge (30 ngày)
- 71
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codebar/planner
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
expenses
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codebar/planner
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
TheOdinProject/curriculum#31423 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
oxidize-rb/rb-sys#807 ·