railsadminteam/rails_admin

Support for turbo-rails 2.x gem

ArturT opened this issue · 4 comments

ArturT commented

Turbo 8 has been released in the turbo-rails gem 2.0.0.pre.beta.1.

Turbo 8 has a few cool features and I wanted to test this with the Rails app but the rails_admin depends on turbo-rails < 2 (see spec.add_dependency 'turbo-rails', '~> 1.0' in rails_admin.gemspec).

Reproduction steps

I updated the rails_admin.gemspec file to:

# rails_admin.gemspec
spec.add_dependency 'turbo-rails', ['>= 1.0', '< 3']

I was able to run the Rails app with rails_admin and the latest turbo-rails.
I'm using turbo-rails directly from github because they did some fix (the bug prevented to start my Rails app fix: hotwired/turbo-rails#523 ) that has not been released to rubygems yet.

# my rails app
# Gemfile
gem 'turbo-rails', github: 'hotwired/turbo-rails', ref: '4eb4e928e30be8cd537af8073f98b80ddea4a578'

Describe the bug

When it comes to rails_admin. While I'm using Turbo 8 (turbo-rails 2.x gem) I found an issue.
When I visit the http://localhost:3000/admin/user
In the search bar I type a user name and click on Refresh button then nothing happens. I get the error in the Chrome console:

RangeError: Maximum call stack size exceeded

Screenshot 2023-12-08 at 17 25 47
Screenshot 2023-12-08 at 17 25 59

Workaround

In order to keep using rails_admin and the latest turbo-rails 2.x I disabled Turbo in the rails_admin dashboard.

I added:

// app/assets/javascripts/rails_admin/custom/ui.js
window.Turbo.session.drive = false

Now I can search records in the rails_admin panel. I hope this workaround can be helpful for someone looking for a temporary solution to use both rails_admin and turbo-rails 2.x in your Rails app.

Expected behavior
rails_admin works with the turbo-rails 2.x gem.

Additional context

  • rails version: 7.0.8
  • rails_admin version: 3.1.2
  • rails_admin npm package version: not using
  • full stack trace (if there's an exception)
turbo.source.js:2557 RangeError: Maximum call stack size exceeded
    at uuid (turbo.source.js:363:1)
    at fetch (turbo.source.js:490:1)
    at fetch (turbo.source.js:493:1)
    at fetch (turbo.source.js:493:1)
    at fetch (turbo.source.js:493:1)
    at fetch (turbo.source.js:493:1)
    at fetch (turbo.source.js:493:1)
    at fetch (turbo.source.js:493:1)
    at fetch (turbo.source.js:493:1)
    at fetch (turbo.source.js:493:1)
formSubmissionErrored @ turbo.source.js:2557
requestErrored @ turbo.source.js:892
perform @ turbo.source.js:617
await in perform (async)
start @ turbo.source.js:825
submitForm @ turbo.source.js:2489
formSubmitted @ turbo.source.js:3913
submitBubbled @ turbo.source.js:1067

Let me know if there is something I could help to bring turbo-rails 2.x to rails_admin. Thanks.