-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support to break out viewcomponent #169
Comments
@drnic thanks for bringing this to our attention. I meant to look into it some last week but ran out of time. I hope to prioritize it this week. |
FWIW, I think the solution you found works well though we should definitely make it first class! |
@drnic at the most fundamental level, this already appears to work. Do you have some sample code that you recommend? |
@wagenet I tried implementing this by adding an ApplicationComponent: class ApplicationComponent < ViewComponent::Base
include Skylight::Helpers
instrument_method :render_in
end Then I don't need to add it to all my components and I can just inherit from this ApplicationComponent: class AgreementComponent < ApplicationComponent
attr_reader :agreement
def initialize(agreement:)
@agreement = agreement
end
end But in Skylight I'm only seeing the instrumentation of the superclass: |
@p8 my sincere apologies for the delay in replying here! You might be able to work around this by doing: class ApplicationComponent < ViewComponent::Base
include Skylight::Helpers
instrument_method :render_in
def render_in(*)
super
end
end |
Any chance of bringing this back into play? fwiw, I tried
(and then inheriting from that in my components) |
@ConfusedVorlon This branch implements the necessary normalizer to handle ViewComponent instrumentation: https://github.com/skylightio/skylight-ruby/tree/view-component. The base branch is equivalent to Skylight 6.0.1. You can bundle this branch with
Please note this has not been merged into our main branch yet, as it has been only narrowly tested, so please test it out yourself before deciding to use it in production (that said, the normalizer logic itself is heavily tested, so the risks should be minimal). I used view_component 3.8.0 on a rails 7.1 app, YMMV with other versions. This also requires the following two lines in your application.rb:
|
I'm rendering pages, partials, and actioncable responses with https://viewcomponent.org/ Currently the work done inside the
.rb
component and its.html.erb
template is not shown in skylight. Could we add VC support please?Update
I've had some success sending the rendering time for each component by adding the following two lines to each component class:
The text was updated successfully, but these errors were encountered: