Add compile.view_component ActiveSupport::Notifications event for eager compilation at boot time.#2613
Merged
joelhawksley merged 3 commits intomainfrom Apr 21, 2026
Merged
Conversation
…er compilation at boot time.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new compile.view_component ActiveSupport::Notifications event around ViewComponent’s eager compilation that runs at boot when config.eager_load is enabled, and documents the new event.
Changes:
- Instrument eager compilation in
ViewComponent::Enginewithcompile.view_componentwhenRails.application.config.eager_loadistrue. - Add documentation describing the new compile-time notification and how to subscribe.
- Add a sandbox test intended to cover compile-time instrumentation.
Show a summary per file
| File | Description |
|---|---|
| test/sandbox/test/instrumentation_test.rb | Adds a test intended to validate compile.view_component notifications. |
| lib/view_component/engine.rb | Wraps eager compilation in an ActiveSupport::Notifications.instrument("compile.view_component") block. |
| docs/guide/instrumentation.md | Documents the new compile-time instrumentation event and subscription example. |
| docs/CHANGELOG.md | Adds an entry under main announcing the new instrumentation event. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (1)
test/sandbox/test/instrumentation_test.rb:50
- Unsubscribing by event name here will remove all
compile.view_componentsubscribers in the process, which can cause cross-test interference. PreferActiveSupport::Notifications.unsubscribe(subscriber_handle)for the specific subscription created in this test.
ActiveSupport::Notifications.unsubscribe("compile.view_component")
- Files reviewed: 4/4 changed files
- Comments generated: 2
Contributor
There was a problem hiding this comment.
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 4/4 changed files
- Comments generated: 1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.