Skip to content

Conversation

@chaimann
Copy link
Contributor

@chaimann chaimann commented May 30, 2025

Solidus Admin

Summary

Applies offset when updating position of a resource in the sortable table, for sorting to work correctly in tables with more than one page.
For this to be possible, a change is made to resources_controller to introduce fixed default per_page = 20. While geared_pagination promotes ratios to be used with pagination, I don't really see it fitting in the tabular resources as it's not too common to have tables with variable amount of rows.
It is possible for child controllers to override per_page if they need to use different number or ratios.

Before

Screen.Recording.2025-05-29.at.12.08.38.mov

image

After

Screen.Recording.2025-05-30.at.18.03.18.mov
image

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

chaimann added 3 commits May 30, 2025 18:06
Prior to this change we used geared pagination default ratios of [15,30,
50,100] for paging, which is suitable for loading data during
infinite scroll but not so much with tabular data, where it is more
reasonable to show fixed amount of rows on each page.
Here we allow children controllers to override per_page in case they
still want to use ratios or define their own fixed `per_page` amounts.
sortable_controller.js will use these in order to correctly calculate
new position value.
@chaimann chaimann force-pushed the admin-sorting-with-pagination branch from 09269af to 5d53632 Compare May 30, 2025 16:07
@codecov
Copy link

codecov bot commented May 30, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.82%. Comparing base (7f2d80a) to head (5d53632).
Report is 42 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6267   +/-   ##
=======================================
  Coverage   88.82%   88.82%           
=======================================
  Files         850      850           
  Lines       18341    18344    +3     
=======================================
+ Hits        16291    16294    +3     
  Misses       2050     2050           

☔ View full report in Codecov by Sentry.
📢 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.

@chaimann chaimann marked this pull request as ready for review May 30, 2025 16:48
@chaimann chaimann requested a review from a team as a code owner May 30, 2025 16:48
@tvdeyen tvdeyen merged commit 0106345 into solidusio:main Jun 4, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants