Cells vs ViewComponents #8933
Replies: 4 comments 6 replies
-
Hi! It's been a while since I wrote that quote, and there's something I'd change from that: instead of first moving all Cells to ViewComponents, I'd start by mixing both systems, and gradually replacing cells. I'm sure migrating isn't gonna be a pain, but it'll take a while, so I'd start adding any new component directly with ViewComponents instead of Cells. |
Beta Was this translation helpful? Give feedback.
-
Please be consider the already known issues form_for compatibilityViewComponent isn’t currently compatible with form_for helpers. Inconsistent controller rendering behavior between Rails versionsIn versions of Rails < 6.1, rendering a ViewComponent from a controller doesn’t include the layout. Forms don’t use the default form builderCalls to form helpers such as form_with in ViewComponents don’t use the default form builder. This is by design, as it allows global state to change the rendered output of a component. Instead, consider passing a form builder into form helpers via the builder argument:
|
Beta Was this translation helpful? Give feedback.
-
Another thing that we could take into account, is the dell / component extensibility. I have found myself often in a situation where i needed to override the entire cell template just to add a css class. And later, that particular template has been changed by Decidim to something else. |
Beta Was this translation helpful? Give feedback.
-
I think we should revisit this discussion as there are some stagnant or not so well maintained (low number of maintainers, low activity) dependencies with the ViewComponent is currently also reaching the popularity of Cells which was not the case yet when the original issue was created: |
Beta Was this translation helpful? Give feedback.
-
As you know, we're in the process of RedesignDecidim, and as such is a perfect time to rethink about the current dependencies that we have.
Initially, we were thinking about migrating from our current view component gem (Cells) to the shiny new gem that's getting lots of traction (ViewComponent).
There are some good things about both solutions, and before making a final decision if we should make the change, we wanted to hear more about our community about what they think about these solutions.
Cells
See more metadata at RubyToolbox
ViewComponent
See more metadata at RubyToolbox
As background information, we've already started a discussion in other places (see #7234). The idea of this new discussion is to have a place to only talk about this subject.
A good summary is what @mrcasals mentioned in that thread:
The "more traction, more community" is visible in this graph of a popularity metric (GitHub stars), but we think it'd be extrapolated to others too:
https://star-history.com/#trailblazer/cells&github/view_component&Date
Even though it's not at the same level, it's growing faster.
So, the questions would be: Is ViewComponent ready and mature? Should we migrate? The benefits outweigh the costs of doing so?
Beta Was this translation helpful? Give feedback.
All reactions