pitosalas PRO said almost 4 years ago on ViewComponent in Rails :
Thanks for an interesting episode... One of the benefits you cite is performance. i don't see where the performance win would come from...

David Kimura PRO said almost 4 years ago on ViewComponent in Rails :
```In early benchmarks, we’ve seen performance improvements over the existing rendering pipeline. For a test page with nested renders 10 levels deep, we’re seeing around a 5x increase in speed over partials: Comparison: component: 6515.4 i/s partial: 1251.2 i/s - 5.21x slower ``` It is interesting, they're showing 5x difference in some cases. Perhaps one level deep, the difference would be small, but on 10 levels deep, that's a pretty significant change.

pitosalas PRO said almost 4 years ago on ViewComponent in Rails :
any idea why? after all the .erb processor is still invoked...

David Kimura PRO said almost 4 years ago on ViewComponent in Rails :
I would assume that it has less to do with erb processing and more to do with the modules that are getting loaded in with a normal partial being rendered. In the last example of the episode, we saw how we could add in other modules for stuff like url helpers. There are likely a lot more helpers being loaded in which would account for the extra time to render the partials.

inopinatus said almost 4 years ago on ViewComponent in Rails :
I'm usually in favour of object/class based solutions, but ActionView::Component isn't my cup of tea at all. It's used at Github to solve problems most folks don't have, and frankly I think it goes way overboard in the wrong direction. Most tellingly, it's not an enthusiastic participant in the framework. All the boilerplate required shows us that, and there's no convention over configuration on display - their demo application has to use an if/else to choose a component instead of any kind of polymorphism. Take the benchmarks with a huge pinch of salt as well, because rendering a collection via partials is already very efficient. Note that the PR that has been merged is *not* ActionView::Component but support for the `render_in` hook that it depends on.

David Kimura PRO said almost 4 years ago on ViewComponent in Rails :
My guess is that there will be a lot of fine tuning done so it better fits into the Rails-way/style of things. I think that it has made some good improvements since its original design. I haven't given complete buy in to it yet, but will definitely be keeping a close eye on it over the next many months. Though, having a lot of my view being tested in the same fashion of the rest of my code does seem very appealing.

patel1wq said over 3 years ago on ViewComponent in Rails :
You might wanna update your video, it's already outdated

David Kimura PRO said over 3 years ago on ViewComponent in Rails :
My dive into ViewComponent is probably on hold until it settles down a bit. 

I'll probably revisit older episodes down the road as it is inevitable for things to get out of date.

This is a pretty good read of what's been going on with this gem. https://github.com/github/actionview-component/issues/206

patel1wq said over 3 years ago on ViewComponent in Rails :
Cool Thanks man! I am just getting hard time using this in my existing application. I am suppose to demo this tomorrow and its not working for me. Just too stressed man

David Kimura PRO said over 3 years ago on ViewComponent in Rails :
Any specific errors or issues?

patel1wq said over 3 years ago on ViewComponent in Rails :
So basically in my components's `Mycomponent.html.erb` file I am using a helper function `current_user_role` defined in a BaseController class. But the Components says that it can not find any variable or method with this name, which makes sense because I will have to inherit from that class. Now the issue is that Components already inherit `ViewComponents::Base` (yeah name changed). I know there should be a work around but I am kind of new to Ruby and am facing a hard time

almokhtar PRO said about 3 years ago on ViewComponent in Rails :
after a half year do you recomend it 

David Kimura PRO said about 3 years ago on ViewComponent in Rails :
  It's still picking up traction and getting adopted more and more. I'd still consider it, especially since it's being backed by a larger company; github.

Login to Comment