Skip to content

Migrate bookkeeping lookup mount to React on Rails#13489

Open
justin808 wants to merge 1 commit intohackclub:mainfrom
justin808:codex/react-on-rails-bookkeeping
Open

Migrate bookkeeping lookup mount to React on Rails#13489
justin808 wants to merge 1 commit intohackclub:mainfrom
justin808:codex/react-on-rails-bookkeeping

Conversation

@justin808
Copy link
Copy Markdown

Summary of the problem

hcb already uses react-rails, but that leaves the app on an older Rails + React integration path while newer maintenance and documentation effort is concentrated around React on Rails and Shakapacker.

I maintain both react-rails and react_on_rails, and for incremental Rails + React work I recommend moving toward React on Rails because it is the better-supported path going forward.

This PR is intentionally small. It converts one admin mount (bookkeeping/StripeChargeLookup) first so the app can prove a safe coexistence path before touching any broader frontend architecture.

Background docs:

Describe your changes

This keeps the rest of the app untouched and only migrates the bookkeeping lookup mount.

Changes in this slice:

  • add the react_on_rails gem and JS package
  • register BookkeepingStripeChargeLookup in the existing JS bundle
  • swap the bookkeeping view from react-rails to an explicit react_on_rails_component helper
  • preserve the legacy react_component(...) behavior for the many remaining react-rails mounts so both integrations can coexist safely during an incremental migration
  • add a focused controller spec covering the new mount contract

Why this is better:

  • it gives the app a supported migration path away from react-rails without forcing a full rewrite
  • it makes the mount boundary more explicit and easier to evolve route by route
  • it keeps future React on Rails / Shakapacker documentation and upgrade guidance applicable to the app

Local validation:

  • repo Dockerfile build succeeds
  • yarn build
  • yarn build:css
  • bundle exec rspec spec/controllers/admin_controller_bookkeeping_spec.rb
  • bundle exec rubocop app/helpers/react_on_rails_migration_helper.rb config/initializers/react_on_rails.rb config/initializers/react_on_rails_helper_override.rb spec/controllers/admin_controller_bookkeeping_spec.rb

Asset-level comparison in the same Docker image:

  • bundle.js: 2,739,714 -> 2,754,760 bytes (+15,046)
  • yarn build: 10,035 ms -> 9,101 ms

So this first slice adds a small amount of bootstrap code, but it does not introduce a build-time regression, and the primary win is maintainability plus a cleaner forward migration path.

@garyhtou
Copy link
Copy Markdown
Member

Hey Justin! Great to hear from you 😊!

I'll give this a read next week—let me know once this is ready for review.

@justin808 justin808 marked this pull request as ready for review April 19, 2026 09:16
@justin808 justin808 requested a review from a team April 19, 2026 09:16
@justin808 justin808 requested a review from garyhtou as a code owner April 19, 2026 09:16
@justin808
Copy link
Copy Markdown
Author

Ready for review. I reran the slice in the repo documented Docker Compose path: docker compose run --rm -e RAILS_ENV=test web bundle exec rails db:test:prepare, docker compose run --rm -e RAILS_ENV=test web bundle exec rspec spec/controllers/admin_controller_bookkeeping_spec.rb, plus yarn build, yarn build:css, and focused RuboCop. The main value is still the safe coexistence path: one admin-owned mount moves to React on Rails without forcing a broader frontend rewrite.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants