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
Question: Are lifecycle args a part of the public API of configureRouter? #547
Comments
Bump, just came across this parameter and would love to know if this is here to stay. |
Well, I am the third. @davismj neither endorses nor totally rejects the usage. |
They are here to stay since we have no intention of introducing breaking changes. I may or may not document them at some point since, as @huochunpeng mentioned, I think this leads developers down a bad path that leads to architectural problems. |
@davismj actually I rely on dynamic behaviour quite a lot. I have many pure backend defined dynamic routes like the one I showed you in the last post of the discourse topic. In many parts of my app, I have no way to pre-define routes. My app is in cloud business. For instance, I need to show tabs "AWS" and "AZURE" because those are the cloud providers that client (app user) is using. That can be only defined at runtime, because another client might uses "VMWARE" and "ORACLE". |
|
You did not get my point. “AWS” is unknown noun in my front-end code, it is just a provider. The list of providers is unknown, and should not be anyway hard coded by frontend code. |
In our architecture, provider type can be added to the app through plugin (backend). So some client can have their own provider named “Lorem” with a total different config and backend logic. |
Keep in mind that 1. During initial composition (templating lifecycle) of the top-level
|
Very grateful for your informative inside. I used Router injection but no more than doing manual navigation. |
Are the lifecycle args that are passed to
configureRouter
alongside theRouterConfiguration
and theRouter
part of the intended public API ofconfigureRouter
?They are currently undocumented.
Currently the configureRouter callback is called like this (in route-loading.js)
return childRouter.configure(c => viewModel.configureRouter(c, childRouter, ...lifecycleArgs)) .then(() => component);
This means I can access any route parameters very easily and conditionally configure my router based on properties of an entity I load. I can also return a Promise. I'm currently doing this, but the docs don't mention any extra parameters (http://aurelia.io/docs/api/router/interface/ConfiguresRouter/method/configureRouter)
I'm worried if I rely on this method it might be deprecated in the future as it's not a documented public feature. Happy to send a pull request to the docs documenting with these extra parameters if that's helpful.
The text was updated successfully, but these errors were encountered: