Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please bring back optional horizontal pagination #3680

Closed
elleaiello opened this issue May 2, 2024 · 3 comments
Closed

Please bring back optional horizontal pagination #3680

elleaiello opened this issue May 2, 2024 · 3 comments

Comments

@elleaiello
Copy link

elleaiello commented May 2, 2024

Hi there 馃憢

I recently upgraded our Rails 6.1 project from v2 to v3 of Rails Admin. We are seeing performance hit as a result of the now default sidescrolling when viewing the list of records for certain models. This was not a problem previously because of the horizontal pagination. However, we are now running into memory issues because ALL the associations on the first few records are fetched from the db and loaded into memory to display in the table.

Feature request: please could you bring back the sidescroll option or similar config. I'm happy to create a PR for this if you'd like? There isn't much context in the removal commit (d51e943) as to why it was removed, so wanted to check first.

I can solve my issue by restricting the fields on the terribly performing models (I am excluding most of the has_many associations), but a universal solution would be better... Sidescrolling worked well enough to solve this! An alternative would be an option not to load associations 馃

Also let me know if there's some solution/workaround I'm missing 馃

@mshibuya
Copy link
Member

mshibuya commented May 5, 2024

The optional sidescroll feature was removed because it adds maintenance overhead. Making it the default behavior allowed removal of conditionals and logics from the codebase, as you can see from the commit.

we are now running into memory issues because ALL the associations on the first few records are fetched from the db and loaded into memory to display in the table.

That happens, especially with has_many associations as you mentioned. My recommendation is to always use the field directive to explicitly opt-in the fields to be shown. This usually results in better usability unless the model is very simple (in your case that's not the case), as you can show only fields that are meaningful to users with friendly order.

You can also exclude all has_many fields like this, though I don't recommend much.

  config.model Foo do
    fields_of_type :has_many_association do
      hide
    end
  end

@elleaiello
Copy link
Author

elleaiello commented May 7, 2024

Thanks @mshibuya, I think the blanket exclusion of has_many fields is what I'm looking for. Why don't you recommend it?

@mshibuya
Copy link
Member

As I wrote, being explicit is the better and more flexible way.

@elleaiello elleaiello closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants