Coming from this thread https://mobile.twitter.com/oligriffiths/status/993837170317234181 I decided to post my thoughts in more then just a tweet and get others to reply.
Looks like there are a few ideas and projects that are rethinking the role of the Route in an Ember app. One of those early ideas was “Routable Components” and I think there is still something there that can be salvaged to make Ember a simpler and more coherent framework.
There are several ways that this could go, the two most obvious are:
- Route -> Component
- Route -> Template -> Component (https://mobile.twitter.com/Thoov/status/993733133894799361)
One downside I see to #1 is that it’s not as clear which component is associated with a route. Does that have to be set in the Route or should it be a convention like
<routeName>-route component, e.g.
users-route. The other issue is how to define the data and the actions on the component without that intermediate template. I modified @thoov’s gist for #2 to reflect #1 here: https://gist.github.com/knownasilya/5db86b6ddbd2c8bcabbed77567ec3798 just to get some brainstorming going.
With #2 doing
ember g route <routeName> also creates a template, but that template doesn’t automatically have a component so that’s an extra step and there is no way to know if the template rendered without a component with the APIs currently in the Route. If the controller is removed, which data is passed to this template and does that data include actions as well? So there are a few unresolved questions.
I’d like to see a discussion about which convention is more fitting for Ember, or if it’s another one altogether. What other pros/cons are there for each solution?