ViewComponent/view_component
56.1
Adequate · 28 September 2026
4.5k
lines of production code
Ruby
primary language
2
measurements over time
What this system is
ViewComponent is a Ruby gem that provides a framework for building reusable, testable view components within Rails applications. It supports modern development workflows through inline templates, background job serialization, and comprehensive generator scaffolding for various template engines and assets. The system includes robust tooling for performance benchmarking, Ractor-readiness auditing, and isolated testing environments to ensure compatibility across multiple Rails versions.
How it got here
2019–2020 — ViewComponent v4.15.0 release and modernization
13 changes.
This period focused on releasing ViewComponent v4.15.0, which included dropping legacy ActionView::Component support, adding Rails 8.1 compatibility, and introducing Active Job serialization. The work also involved modernizing development tooling with StandardRB, enhancing test infrastructure for robustness, and adding automation scripts for releases and contributor management.
2021 — Test infrastructure and sandbox modernization
8 changes.
This period focused on expanding the test sandbox to support Rails 8 and Turbo 2, including reorganized configuration, new component fixtures, and performance benchmarks. It also introduced GitHub Codespaces support to streamline bug replication and debugging workflows.
2022–2025 — Rails 8.1 compatibility and inline templates
11 changes.
This period focused on extending ViewComponent support to Rails 8.1 and introducing inline template capabilities for single-file components. The work included refactoring generators to support these new features, centralizing preview controller logic, and releasing a new TestEngine for isolated testing. Comprehensive test suites were added to validate core functionality, generator outputs, and compatibility across multiple Rails versions.
Features
Add benchmark view templates for rendering performance testing
New partial view templates (\_partial.html.erb and \_nested.html.erb) have been added to the performance/views/benchmarks directory to support rendering benchmarks. The \_partial template renders a heading and iterates 50 times to render the \_nested template, allowing for the measurement of view rendering performance under load.
performance/views · high confidence
Add performance benchmark components for ViewComponent patterns
Added a suite of ViewComponent-based benchmark fixtures in the \performance/components\ directory to measure rendering performance across different patterns. These include components for global I18n (\GlobalI18nComponent\), sidecar I18n (\TranslatableComponent\), nested rendering (\NameComponent\, \InlineComponent\, \NewInlineComponent\), and slot usage (\SlotsComponent\). These components serve as the basis for performance tracking and comparison.
performance/components · high confidence
Add support for Rails 7.1, 7.2, 8.0, 8.1, and 8.2
The gemfile appraisal suite now includes configurations for Rails 7.1, 7.2, 8.0, 8.1, and 8.2 (including the main development branch), enabling the library to be tested against these versions. This ensures compatibility with the latest Rails releases and allows users to integrate the library into applications running on these frameworks.
gemfiles · high confidence
Added GitHub Codespaces configuration for bug replication
Developers can now use GitHub Codespaces to quickly replicate bugs using a pre-configured Ruby on Rails and PostgreSQL environment. The new .devcontainer setup includes a Dockerfile with Rails and Webdrivers, a docker-compose configuration linking the app to a Postgres database, and a devcontainer.json that automatically runs the 'script/replicate-bug' command upon creation to streamline the debugging workflow.
.devcontainer · high confidence
Initial release of the TestEngine Rails engine
This change introduces the TestEngine, a new Rails engine that isolates the TestEngine namespace and provides a scaffold for ViewComponent-based features. It includes a basic ExampleComponent with its template, a preview for visual testing, and generator tests to ensure components, previews, and test files are created correctly within the engine's isolated namespace. The engine is initialized at version 0.1.0.
_test\engine · high confidence
New Active Job serializer for ViewComponent serialization
ViewComponent now includes a dedicated Active Job serializer that enables components to be passed as arguments to background jobs. The new \ViewComponent::ActiveJobSerializer\ detects \ViewComponent::Serializable::Proxy\ instances and handles their serialization and deserialization, allowing components to be safely queued and processed by Active Job.
_lib/view\component · high confidence
New preview and system test controllers for ViewComponent
Two new controllers are introduced to handle ViewComponent previews and system testing: \ViewComponentsController\ serves as the base for preview actions, while \ViewComponentsSystemTestController\ provides a dedicated endpoint for system tests. The system test controller includes security measures to prevent arbitrary file read vulnerabilities by validating file paths against a temporary directory, ensuring that only files within the expected scope are rendered.
app/controllers · high confidence
New preview index and detail pages for ViewComponent previews
The application now includes dedicated view templates for browsing and viewing component previews. The new \index.html.erb\ provides a list of all available previews with links to their individual pages, while \previews.html.erb\ displays the examples for a specific preview. The \preview.html.erb\ template handles the actual rendering of a selected preview, supporting both direct component rendering and template-based previews with locals.
_app/views/view\components · high confidence
New release and contributor automation scripts
The repository now includes several new scripts to streamline the release process and documentation maintenance. \script/publish\ handles the final release steps, including GitHub permission checks, tag creation, changelog extraction, documentation publishing to gh-pages, and GitHub release creation, while explicitly dispatching the \push\_gem\ workflow to ensure the gem is pushed to RubyGems. \script/release\ automates the pre-release workflow by creating a release branch, updating version numbers in \lib/view\_component/version.rb\ and \lib/view\_component/deprecation.rb\, updating lockfiles, building docs (which now includes syncing contributors via \script/sync\_contributors.rb\), and opening a PR. \script/replicate-bug\ helps developers create a minimal Rails app to reproduce bugs, and \script/sync\_contributors.rb\ fetches contributor data from the GitHub API to update \docs/\_data/contributors.yml\. Additionally, \script/console\ has been updated to require \view\_component\ instead of \action\_view/component\.
script · high confidence
Architecture
Centralize preview controller logic into a reusable concern
The preview controller functionality has been extracted into the \ViewComponent::PreviewActions\ concern. This change centralizes the logic for rendering component previews, handling locale setting, and managing view paths, ensuring that the preview actions are consistent and reusable across different controllers. Users benefit from a more modular architecture where preview-related behaviors are encapsulated in a single, maintainable location.
app/controllers/concerns · high confidence
Behavioural changes
Add Ractor-readiness auditing and modernize development tooling
The project now includes an \.audition.yml\ configuration and a \.audition-baseline.json\ file to track Ractor-readiness findings (such as class-level state and unsafe calls) for Ruby's concurrency features, ensuring new code does not introduce regressions. Development tooling has been updated to use StandardRB instead of Rubocop-GitHub, and the test suite now runs RSpec tests alongside Minitest via a new \rspec\ rake task and \.rspec\ configuration. The \.tool-versions\ file sets the development Ruby version to 4.1-dev, and the \Appraisals\ file has been expanded to test against Rails 7.1, 7.2, 8.0, 8.1, and main branches.
(repo-wide) · high confidence
Generators reorganized under ViewComponent namespace with inline template support
The generator files have been moved into the \ViewComponent::Generators\ namespace and refactored to use a shared \AbstractGenerator\ module. This change introduces a new \--inline\ option for the component generator, allowing users to generate components with the template code embedded directly in the Ruby class (via \template\_engine\_template\) instead of a separate view file. The generators now read configuration from the \config.generate\ namespace (e.g., \config.generate.path\, \config.generate.sidecar\) and support generating Stimulus controllers with TypeScript options, locale files, and previews alongside the component.
lib/generators · high confidence
Removal of ActionView::Component monkey patch and base class
The file lib/action\_view/component.rb has been deleted, removing the previous implementation of the ActionView::Component base class and its monkey patch to ActionView::Base\#render. This change eliminates the custom rendering logic that allowed components to be rendered via the standard render helper, a patch that was previously necessary for Rails versions prior to 6.1.0. Users relying on this specific file for component rendering will need to update their setup, as the core component infrastructure has been restructured or moved elsewhere.
_lib/action\view · high confidence
Support for inline templates, serializable component proxies, and Rails 8.1 ERB compatibility
ViewComponent now supports single-file components via the new InlineTemplate module, allowing templates to be defined directly within the component class. It introduces a Serializable::Proxy that enables components to be serialized for background jobs and Turbo Streams by deferring instantiation and capturing slot calls. Additionally, the template compilation logic has been updated to handle Rails 8.1's ERB newline changes and prevent segfaults when Ruby coverage is enabled, while internal documentation components have been removed from the shipped library.
_view\component · high confidence
ViewComponent library initialization and autoload structure
The ViewComponent library now initializes by requiring core dependencies like ActionView and ActiveSupport, and defines the main ViewComponent module with explicit autoloads for key classes such as Base, Compiler, Config, and Translatable. Test-specific helpers (TestHelpers, SystemSpecHelpers, etc.) are conditionally loaded only when running in a Rails test environment, and the engine is automatically required if Rails is present, ensuring seamless integration without manual setup.
lib · high confidence
Test coverage
Add RSpec test configuration and system spec driver; Added comprehensive test suite for ViewComponent sandbox; Added generator tests for ViewComponent scaffolding; Added performance benchmarks for components and translations; Added preview templates for testing component rendering scenarios; Added test coverage for ViewComponent previews and system interactions; Added test coverage for component translation scoping and preview rendering; Added test for preventing duplicate autoload paths; Added test mailer views for component rendering; Enhanced test infrastructure and new docs task coverage; Expanded test sandbox with new component fixtures; Removed legacy test suite and demo view for ActionView::Component; Removed test application configuration; Sandbox test environment initialization and validation; Sandbox test environment reorganized for Rails 8 and Turbo 2 compatibility; Test environment configuration updates and warning suppression.
Dependencies
ViewComponent v4.15.0: Rails 8.1 support and dependency overhaul
ViewComponent has been updated to version 4.15.0, introducing support for Rails 8.1 and requiring Ruby 3.2 or higher. The gemspec now explicitly declares runtime dependencies on \actionview\ and \activesupport\ (version \>= 7.1.0) alongside \concurrent-ruby\. Development dependencies have been significantly modernized, including upgrades to \minitest\ (\~\> 6), \haml\ (\~\> 7), \tailwindcss-rails\ (\~\> 4), and \turbo-rails\, while replacing \rubocop\ with \standard\ for linting. The project has also been renamed from \actionview-component\ to \view\_component\, and the documentation site now uses the \github-pages\ gem with \webrick\ for local development.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 60 → 56 (-3.8)
- Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.
Lenses
- Code Health 98 → 98 (+0.0)
- Architecture 79 → 73 (-6.5)
- Maturity 60 → 60 (-0.4)
- Readiness 49 → 42 (-7.6)
- Security 73 → 78 (+4.9)
Resolved (10)
- Change coupling: component_generator.rb ↔ erb_generator.rb (lib/generators/view_component/component/component_generator.rb)
- Documentation: no installation or build instructions (README.md)
- Documentation: no installation or build instructions (docs/README.md)
- Documentation: no licence statement (docs/README.md)
- Documentation: no project overview (README.md)
- Documentation: no project overview (docs/README.md)
- Documentation: no usage examples (docs/README.md)
- High: security finding (details withheld)
- Off-boarding risk: anonymized user #1
- Repeated repair: lib/view_component/template.rb (lib/view_component/template.rb)
New (13)
- Ambiguous distinction between 'render' and 'render_in'. In ViewComponent, 'render_in' is the standard method for rendering a component instance. 'render' on the base class often delegates or is a class-level helper. The signature difference (options/args vs view_context) suggests different use cases, but the naming is close enough to cause confusion about when to use which.
- Documentation: no installation or build instructions (docs/guide/index.md)
- Documentation: no project overview (docs/guide/index.md)
- Documentation: no usage examples (docs/guide/index.md)
- Duplicate intent across different modules. Both provide access to the Capybara page object in system tests. Having two separate entry points (one in a helper module, one in a test case class) creates confusion about which to use.
- Further sole-owners (lower concentration)
- Inconsistent naming for test rendering helpers. 'render_inline' is a standard ViewComponent convention, but 'render_preview' breaks the pattern. It suggests a specific action rather than a generic rendering helper. Furthermore, 'render_in_view_context' exists, which is even more generic.
- Off-boarding risk: anonymized user #1
- Outdated: actionview
- Outdated: activesupport
- Outdated: yard-lint
- Projects may be oversized for their cohesion
- Redundant methods with ambiguous distinction. Both methods likely return the list of available previews, but it is unclear if they differ by caching, filtering, or return type. 'index' suggests a collection action (like a controller), while 'previews' is a direct noun accessor.
Changes since last survey
- 17 commits — 16 feature/other, 1 fixes
By area
- (repo) — 6 commits
- test/sandbox — 6 commits
- docs/CHANGELOG.md — 2 commits
- lib/view_component — 2 commits
- .github/workflows — 1 commit
Notable commits
- fix: Merge pull request #2716 from mizoR/fix-erb-newline-compensation-for-unannotated-templates
- change: Autoload digest fixtures with Zeitwerk
- change: Exercise errors through cache_on
- change: Expire memoized template digests when a component registers
- change: Fix cache digest prose lint
- change: Merge branch 'main' into vc-digest-cache-block-in-component-template
- change: Merge origin/main into vc-digest-report-swallowed-errors
- change: Merge pull request #2709 from erikaxel/vc-digest-registration-invalidates-cache
- change: Merge pull request #2712 from erikaxel/vc-digest-report-swallowed-errors
- change: Merge pull request #2714 from erikaxel/vc-digest-cache-block-in-component-template
- change: Only compensate for the ERB newline Rails actually adds
- change: Raise cache digest errors
- change: Refactor cache_digest method call
- change: Test digest errors through a component
- change: Test digest errors through public API
- change: Update docs/CHANGELOG.md
- change: pin audition
Architecture
- Unchanged — 0 containers · 1 contexts · 0 edges
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
ViewComponent/view_component was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 28 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 23ceae2d60864009f8336ff2631c99b7eb9c1f6b — the exact code this score is about.
- Scored under rubric-2026.09.16 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-2d9048c36d26.