-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Module Unification] Routes can only be nested two levels deep #17217
Comments
The problem seems to be somewhere in {
type: "route",
name: "index",
namespace: undefined,
collection: "routes",
rootName: "foo/bar"
} I think it should rather look like this: {
type: "route",
name: "foo/bar/index",
collection: "routes",
rootName: "mu-nested-routes"
} Or maybe? {
type: "route",
name: "index",
namespace: "foo/bar",
collection: "routes",
rootName: "mu-nested-routes"
} |
I assume the |
@buschtoens have you tried the fallback resolver? |
@NullVoxPopuli I am already using the fallback resolver, as can be seen here. But that is actually a very good point to make. I'll give the |
@NullVoxPopuli No luck here. Apparently
|
excellent! (one less thing to fix) |
Ha! I just found out that this only happens, if the third-level |
I think I've pinned down the issue. So in L90 {
type: "controller",
name: "index",
namespace: "foo/bar",
collection: "routes",
rootName: "dummy"
} The resolver cannot find the
{
type: "controller",
name: "index",
namespace: undefined,
collection: "routes",
rootName: "foo/bar"
} This is then serialized as {
type: "controller",
name: "index",
namespace: "routes",
collection: "bar",
rootName: "foo"
} Notice how this differs from the prior specifier: {
type: "controller",
name: "index",
- namespace: undefined,
+ namespace: "routes",
- collection: "routes",
+ collection: "bar",
- rootName: "foo/bar"
+ rootName: "foo"
} What ultimately causes the _checkDefaultType(specifier) {
let {defaultType} = this._config.collections[specifier.collection];
return defaultType && defaultType === specifier.type;
} A simple fix to make this safer would be: _checkDefaultType(specifier) {
let { defaultType } = this._config.collections[specifier.collection] || {};
return defaultType && defaultType === specifier.type;
} However this does not fix the inconsistent de-/serialization. But is this actually a problem we need to worry about? The input specifier already looks off to me. In any case, I'll prep a PR for the above fix and test it. |
This can be marked as closed 😃 Maybe cut a release for ember-resolver that contains the fix (it's already on master) |
Closing, thanks! |
Defining routes nested more than two levels deep or even just providing a callback does not work MU applications and triggers the error below.
Exemplary failing router:
Reproduction repo: https://github.com/buschtoens/mu-nested-routes
The text was updated successfully, but these errors were encountered: