Skip to content

Add compile.view_component ActiveSupport::Notifications event for eager compilation at boot time.#2613

Merged
joelhawksley merged 3 commits intomainfrom
instrument-compilation
Apr 21, 2026
Merged

Add compile.view_component ActiveSupport::Notifications event for eager compilation at boot time.#2613
joelhawksley merged 3 commits intomainfrom
instrument-compilation

Conversation

@joelhawksley
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 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::Engine with compile.view_component when Rails.application.config.eager_load is true.
  • 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_component subscribers in the process, which can cause cross-test interference. Prefer ActiveSupport::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

Comment thread test/sandbox/test/instrumentation_test.rb Outdated
Comment thread test/sandbox/test/instrumentation_test.rb Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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

Comment thread docs/guide/instrumentation.md
@joelhawksley joelhawksley merged commit ef90407 into main Apr 21, 2026
22 checks passed
@joelhawksley joelhawksley deleted the instrument-compilation branch April 21, 2026 02:06
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