Skip to content

Prevent development welcome route from duplicating on route reload#57367

Open
curi wants to merge 1 commit into
rails:mainfrom
curi:fix-development-welcome-route-reload-growth
Open

Prevent development welcome route from duplicating on route reload#57367
curi wants to merge 1 commit into
rails:mainfrom
curi:fix-development-welcome-route-reload-growth

Conversation

@curi
Copy link
Copy Markdown

@curi curi commented May 14, 2026

Motivation / Background

Rails registers its internal development welcome route from routes_reloader.run_after_load_paths.

That hook currently calls app.routes.append on each route reload. RouteSet#append stores append blocks persistently, while route reloads clear and finalize the realized routes. As a result, repeated reload_routes! calls in development add another internal GET / welcome route each time.

Detail

Register the internal welcome route append block only once per application boot, while preserving the existing append behavior and route ordering. This keeps app-appended root routes taking precedence over the internal welcome route.

Additional information

No existing issue found for this specific duplicate welcome-route behavior.

Tests

  • ruby -c railties/lib/rails/application/finisher.rb
  • ruby -c railties/test/application/routing_test.rb
  • bundle exec rubocop railties/lib/rails/application/finisher.rb railties/test/application/routing_test.rb
  • cd railties && bin/test test/application/routing_test.rb -i '/not duplicated|appended root/'
  • cd railties && bin/test test/application/routing_test.rb

Copilot AI review requested due to automatic review settings May 14, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant