RFC to deprecate resetNamespace - #221
Conversation
4ad8f97 to
e062c21
Compare
| However, reseting the namespace of a route prevents developers to intuitively understand | ||
| the placement of a route in the nesting hierarchy of the app by simply reading its name, | ||
| making the mental model and the task of finding a a route in the file system more complex. | ||
| This issue is going to be amplificated by the deeply nested file structure of the |
There was a problem hiding this comment.
I think it's worse than that, because of local/global lookup.
|
We have used That is when having a multilanguage site, we have a In this case the |
|
@simonihmig Your use case is the only acceptable one, but still it just saves you from typing a few chars. In the case of my apps the omnipresent route is |
|
I am not too worried about keystrokes or migration (find and replace in your IDE should do most of it, and decent acceptance test coverage should catch the lost ones. Slightly off topic, but I am not aware of any codemod tools that can easily run on a Handlebars AST, you? As most occurrences of route names are probably with I am more interested to retain the better readability, that you gain by hiding that omnipresent route IMHO. So I am still slightly in favor of having that escape hatch for those special cases that you and me mentioned. But in general I agree, this should not be abused for "normal" routes. |
|
In principle I'm not opposed to this. However, the apps I work on use There is cognitive overhead to thinking about the entire path of routes instead of just the terminal resource you're interested in. The RFC should describe why this is less important than what is in the "Motivation" section currently. The "How We Teach This" section is not extensive enough. I'm not OK with link-to's that long. So you should explain how to avoid them. EDIT: Another practical issue is that deep folder hierarchies take up horizontal space in your editor's file manager. |
|
@mmun The only way out that I can see is engines, but for many apps the degree of encapsulation that engines require is infeasible |
|
I've found this feature to be quite useful for both of the reasons @mmun mentioned. Moreover, I'd like to hear more about why this feature is so dangerous that it should be removed. To me, this feature mostly amounts to scoping which concept present in many languages and frameworks. Module Unification even introduces the concept of "local lookup" which is another form of scoping. |
|
We use this way too much in a way quite similar to @simonihmig The grand majority of our routes are namespaced under an account (contextually like @cibernox mentioned of nesting under authenticated) Used thousands of times across an app I think it saves us quite a bit.... I'm not seeing any real dangers listed other than it being a potential footgun / making apps hard to grok. |
|
In @ef4's EmberConf talk (around 36:00) he showed using |
|
Yes. I think the path to not needing that is making engines configurable/composable enough to make third-party engines practical. Until then, "Third party routes" might sounds like an exotic and unusual thing to do, but I believe it's only unusual today because it's hard. |
|
I had a use case recently. |
|
Actually, my most common use case is not mentioned above. I use it when I need the same subroute under more than one route. This is kind of similar to the third party route issue, just isn't third party. |
| all places where that route was referenced by its name (mostly `{{link-to}}`, but not exclusively). | ||
|
|
||
| However, reseting the namespace of a route prevents developers to intuitively understand | ||
| the placement of a route in the nesting hierarchy of the app by simply reading its name, |
There was a problem hiding this comment.
Wouldn't it be easier to read by having resetNamespace on by default?
What I mean is, this way this.route('deeply.nested.route') will always be an absolute path rather than a relative path to the parent route.
There was a problem hiding this comment.
When the router was first introduced, resetNamespace: true was the default behavior. People really disliked that you had to keep repeating yourself if you wanted to have nicely organized routes on disk.
|
I personally think we should eventually deprecate Based on the conversation here, and the current status of route sharing in addons (including engines) I believe that we should close this for now, but we should absolutely still be working towards a future where it is possible to submit a new RFC along these same lines... |
Rendered
/cc @locks