-
-
Notifications
You must be signed in to change notification settings - Fork 638
Closed
Description
A bug is a crash or incorrect behavior.
Environment
- Ruby version: 3.3.7
- Rails version: 8.0.4
- Shakapacker/Webpacker version: N/A (fresh Rails app, not yet installed)
- React on Rails version: 16.2.0.beta.13 (also affects 16.1.2)
Expected behavior
Running bin/rails generate react_on_rails:install or any Rails command should work when connection_pool gem version 3.0+ is installed.
Actual behavior
Rails crashes with:
connection_pool-3.0.2/lib/connection_pool.rb:48:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError)
from react_on_rails-16.2.0.beta.13/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb:16:in `new'
from react_on_rails-16.2.0.beta.13/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb:16:in `reset_pool'
Root Cause
The connection_pool gem changed its API in version 3.0 to use keyword arguments instead of a hash.
In lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb:16:
# Current code (broken with connection_pool 3.0+)
@js_context_pool = ConnectionPool.new(options) { create_js_context }
# Fix: use keyword argument splatting
@js_context_pool = ConnectionPool.new(**options) { create_js_context }Small, reproducible repo
# Create fresh Rails app
rails new ror_test_app --skip-git
cd ror_test_app
# Initialize git (required for installer)
git init && git add . && git commit -m "Initial"
# Add react_on_rails (this pulls in connection_pool 3.0.2)
echo 'gem "react_on_rails", "16.2.0.beta.13"' >> Gemfile
bundle install
# This crashes
bin/rails generate react_on_rails:installSuggested Fix
Either:
- Update the code to use
**options(keyword splat) - Pin
connection_poolto< 3.0in the gemspec until the code is updated
Happy to submit a PR if helpful.
coderabbitai
Metadata
Metadata
Assignees
Labels
No labels