Skip to content

Centralise the Inertia layout declaration - #1663

Open
skyfallwastaken wants to merge 1 commit into
mainfrom
centralise-inertia-layout-20260901
Open

Centralise the Inertia layout declaration#1663
skyfallwastaken wants to merge 1 commit into
mainfrom
centralise-inertia-layout-20260901

Conversation

@skyfallwastaken

Copy link
Copy Markdown
Member

Summary of the problem

Controllers in the Inertia hierarchy repeat the same Rails layout declaration. Scoped declarations on mixed controllers make ownership less clear even though non-rendering actions do not apply layouts.

Describe your changes

Declare the layout once in InertiaController and remove inherited duplicates. Keep declarations on controllers outside the hierarchy. Add request coverage for a pure descendant and a mixed descendant's Inertia and JSON responses.

Screenshots / Media

Not applicable. No visual changes.

Copilot AI lite review requested due to automatic review settings September 1, 2026 02:38
@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Centralizes the shared Inertia layout declaration in InertiaController and removes redundant declarations from its descendants.

  • Preserves independent layout declarations on controllers outside the inheritance hierarchy.
  • Adds request coverage for inherited Inertia rendering and JSON responses from a mixed controller.

Confidence Score: 5/5

The PR appears safe to merge with no actionable correctness or security issues identified.

The centralized declaration preserves descendant Inertia rendering, while explicit JSON, redirect, and head responses continue to bypass layout rendering; the changed behavior is covered by focused request tests.

Important Files Changed

Filename Overview
app/controllers/inertia_controller.rb Establishes the Inertia layout once at the common controller ancestor.
app/controllers/static_pages_controller.rb Removes the scoped duplicate while retaining Inertia and explicit JSON response paths.
test/controllers/inertia_controller_test.rb Verifies inherited layout rendering and confirms mixed-controller JSON responses remain unwrapped.

Class Diagram

%%{init: {'theme': 'neutral'}}%%
classDiagram
  ApplicationController <|-- InertiaController
  InertiaController : layout inertia
  InertiaController <|-- ExtensionsController
  InertiaController <|-- StaticPagesController
  InertiaController <|-- UsersController
  InertiaController <|-- AdminBaseController
  InertiaController <|-- SettingsBaseController
Loading

Reviews (1): Last reviewed commit: "Centralise Inertia layout declaration" | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR centralises the Inertia layout configuration by declaring layout "inertia" once in InertiaController, removing duplicated (and sometimes scoped) layout declarations across descendant controllers, and adding integration coverage to ensure the layout is applied for Inertia responses without affecting JSON endpoints.

Changes:

  • Declare layout "inertia" in InertiaController as the single source of truth for the Inertia controller hierarchy.
  • Remove redundant layout "inertia" declarations from descendant controllers.
  • Add an integration test covering a pure Inertia descendant and a mixed controller with both Inertia and JSON responses.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/controllers/inertia_controller_test.rb Adds request coverage to verify the inherited Inertia layout renders expected HTML markers and does not wrap JSON responses.
app/controllers/inertia_controller.rb Centralises layout "inertia" for all controllers inheriting from InertiaController.
app/controllers/users_controller.rb Removes duplicated scoped layout declaration now covered by InertiaController.
app/controllers/static_pages_controller.rb Removes duplicated scoped layout declaration now covered by InertiaController.
app/controllers/settings/base_controller.rb Removes duplicated layout declaration now covered by InertiaController.
app/controllers/profiles_controller.rb Removes duplicated layout declaration now covered by InertiaController.
app/controllers/my/project_repo_mappings_controller.rb Removes duplicated scoped layout declaration now covered by InertiaController.
app/controllers/leaderboards_controller.rb Removes duplicated layout declaration now covered by InertiaController.
app/controllers/extensions_controller.rb Removes duplicated layout declaration now covered by InertiaController.
app/controllers/doorkeeper/applications_controller.rb Removes duplicated layout declaration now covered by InertiaController.
app/controllers/deletion_requests_controller.rb Removes duplicated scoped layout declaration now covered by InertiaController.
app/controllers/api_keys_controller.rb Removes duplicated scoped layout declaration now covered by InertiaController.
app/controllers/admin/leaderboard_shadowbans_controller.rb Removes duplicated layout declaration now covered by InertiaController.
app/controllers/admin/base_controller.rb Removes duplicated layout declaration now covered by InertiaController.
app/controllers/admin/account_merger_controller.rb Removes duplicated layout declaration now covered by InertiaController.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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