Skip to content

[solidus_admin] Add configurable pagination resource ratios for admin index pages - #6587

Draft
forkata wants to merge 2 commits into
solidusio:mainfrom
SuperGoodSoft:6520/configurable-resource-count-index
Draft

[solidus_admin] Add configurable pagination resource ratios for admin index pages#6587
forkata wants to merge 2 commits into
solidusio:mainfrom
SuperGoodSoft:6520/configurable-resource-count-index

Conversation

@forkata

@forkata forkata commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Summary

This change aims to introduce a new config that can be used in the admin to customize the resource count ratios for geared pagination, without having to override the global configuration that gem provides.

In the future we can extend this to a per-model config, by switching the static configuration to a hash keyed by the resource name, but for now a single config for all resource types is used.

This is still a rough draft, but since there is another PR attempting to do a similar thing, we thought it may be good to open it up for early feedback. The next step is to specify this in the base resources controller and also extract a shared partial that can be used throughout all other index views.

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@codecov

codecov Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.26%. Comparing base (a044f07) to head (ef99146).
⚠️ Report is 66 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6587      +/-   ##
==========================================
+ Coverage   92.16%   92.26%   +0.09%     
==========================================
  Files        1037     1037              
  Lines       21210    21242      +32     
==========================================
+ Hits        19549    19599      +50     
+ Misses       1661     1643      -18     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

forkata and others added 2 commits September 4, 2026 14:53
This would allow users of the new admin to configure the number of
resources seen on each index route, without having to override the
controller actions or the default constant defined in Geared Pagination[^1].
We considered doing this as a hash per resource type, but for now a
global config is a good starting point.

[^1]: https://github.com/basecamp/geared_pagination/blob/master/lib/geared_pagination/recordset.rb#L3

Co-authored-by: Senem Soy <senem@super.gd>
This passes the new config when paginating orders and products in the
Solidus admin. These two controllers explicitly call the
`set_and_extract_portion_from` helper so they need to receive this
argument explicitly, otherwise the default configuration from the geared
pagination will be used.

Co-authored-by: Senem Soy <senem@super.gd>
@forkata
forkata force-pushed the 6520/configurable-resource-count-index branch from 76d67c8 to ef99146 Compare September 4, 2026 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant