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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reload_records not working with the Grid view #3718

Open
2 of 5 tasks
m7madmagdy opened this issue Mar 5, 2025 · 5 comments
Open
2 of 5 tasks

reload_records not working with the Grid view #3718

m7madmagdy opened this issue Mar 5, 2025 · 5 comments
Assignees
Labels
Enhancement Not necessarily a feature, but something has improved

Comments

@m7madmagdy
Copy link

Context

In the grid view type, if I use reload_records for any action, it's not working correctly and I must refresh the page manually

System configuration

Avo version: 3.17.9

Rails version: 8.0

Ruby version: 3.4.2

License type

  • Community
  • Pro
  • Advanced

Are you using Avo monkey patches, overriding views or view components?

  • Yes. If so, please post code samples.
  • No

Screenshots or screen recordings

@Deepanshu0211
Copy link

Avo reload_records Not Working in Grid View

Issue Description

In the grid view, calling reload_records does not refresh the records correctly. A manual page refresh is required.

System Configuration

  • Avo version: 3.17.9
  • Rails version: 8.0
  • Ruby version: 3.4.2
  • License type: Community / Pro / Advanced
  • Using monkey patches or custom views? No

Debugging Steps

✅ 1. Check Browser Console

  • Open DevTools (F12 → Console)
  • Look for JavaScript errors or network errors when reload_records is triggered

✅ 2. Verify Grid View Setup

  • Are you calling reload_records inside a custom action or controller?
  • Check if the method is being executed properly.

✅ 3. Check Avo Documentation & Source Code

✅ 4. Force Turbo to Work (If Using Hotwire)

Try manually forcing Turbo to refresh:

Turbo.visit(window.location.href, { action: "replace" })

or, soft trigger reload
Avo.reload()

@Paul-Bob
Copy link
Contributor

Paul-Bob commented Mar 6, 2025

Hi @m7madmagdy,

The reload_records action response is not expected to work in grid view. As stated in the docs, this option leverages Turbo Stream to refresh specific table rows in response to an action.

Thanks for reaching out! We'll discuss the possibility of extending this feature to work with other view types, such as grid

@Paul-Bob
Copy link
Contributor

Paul-Bob commented Mar 7, 2025

We'd love to merge a PR if you're up for contributing! I'd be happy to guide you through the process.

@m7madmagdy
Copy link
Author

Hi @Paul-Bob
Yes! I'd love to contribute!, Please guide me through the process, and let me know how I can help. I'm excited to contribute to Avo

@Paul-Bob
Copy link
Contributor

Cool! There’s a contributing guide that will help you set up the local environment, after which you should be able to get started.

The reload_records alias of reload_record is executed here.

This method iterates through all the selected records for the action, reconstructs the table row for each, and then uses append_to_response to append a Turbo stream that replaces each affected record with the newly built component.

Somewhere around here, there should be a view_type set to grid in the parameters. After identifying the grid type, you’ll need to replicate this logic, but instead of reconstructing a table row, it should reconstruct a grid card.

Let me know if you have any questions or run into any blockers.

Thanks for taking the initiative, we really appreciate it!

@Paul-Bob Paul-Bob moved this from Triage to To Do in Issues Mar 12, 2025
@Paul-Bob Paul-Bob added the Enhancement Not necessarily a feature, but something has improved label Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Not necessarily a feature, but something has improved
Projects
Status: To Do
Development

No branches or pull requests

3 participants