fix(router): lazy loaded empty root path loads with auxiliary outlet#25483
fix(router): lazy loaded empty root path loads with auxiliary outlet#25483attilavegh wants to merge 1 commit intoangular:masterfrom attilavegh:fix-lazy-loaded-root-with-aux-outlet
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
|
CLAs look good, thanks! |
Initial page load with secondary outlet and lazy loaded root with empty path '/(aux:path)' causes error, because the empty root path is not matched and '_loadedConfig' is undefined. This works fine if the root path is not empty or the root is not a lazy loaded module
|
There is any update on this yet? |
|
I'd appreciate this fix being merged too! 👍 |
|
This fix would be fantastic 🙏 |
|
When the estimated time this fix will come? I'm in need of this fix and don't want to edit the packages myself due to wanting future fixes. |
|
We do not want to change all of our empty routes and we still need that functionality. Even though it's faaar from being ideal, I can't help to think that it might be useful for others so use this with caution
|
|
Is there anything that can be done to speed things up? |
|
Indeed - if there's anything the community can do to help this move ahead, please let us know. We have a set of huge apps with some horrible janky router workarounds we'd love to remove. Somehow encountered this issue with nearly every Angular app I've ever worked on. Thanks so much for the PR, by the way, @attilavegh ! |
|
Seems this bugfix is really needed. I went to this issue too. Edit: Edit2: |
|
I have being debugged this at @angular/router level and I found that here: is calling this: So since Edit: angular/packages/router/src/apply_redirects.ts Lines 179 to 181 in f8096d4 and put a delay(100) between concatAll and first here:seems to work Edit2: |
|
Any updates on this? |
|
@attilavegh I created my own PR with for that problem because your doesn't fix issue in case like this: {
path: '',
outlet: 'footer',
component: LinksBarComponent
},
{
path: '',
loadChildren: () => import('./modules/main/main.module').then(m => m.MainModule)
},@joselcvarela Thank you very much! Your comment gave me right direction |
|
@asvishnyakov So will this fix the following issue In my app-routing i have and if I try loading the site directly using https://localhost:4200/(popup:cookie) it throws an error of |
|
@dottodot It should |
|
We are too having this nasty Can someone from the Angular team comment on whether this PR is going to be merged during our lifetime? |
|
This issue was originally reported more than 3 years ago in Angular 2.0.0-rc.5. It was marked as critical more than 2 years ago, and still we have no idea if fix for it is even planned? |
|
Closing for a couple reasons:
|
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Initial page load with secondary outlet and lazy loaded root with empty path '/(aux:path)' causes error, because the empty root path is not matched and '_loadedConfig' is undefined. This works fine if the root path is not empty or the root is not a lazy loaded module.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Given the following route configuration:
With this configuration, using the outlet as an entry point to the application, the root module will not load properly and results in the following error:
TypeError: Cannot read property 'routes' of undefined at getChildConfig (router.js:3041)The
_loadedConfigproperty of the route remainsundefinedas theexpandSegmentAgainstRoute()returns withnoMatch().This issue is only present if the root has a lazy loaded module, works fine with a component or even with a lazy loaded module if the root path is not empty.
Issue Number: N/A
What is the new behavior?
The above mentioned issue is fixed in this pull request, the config is properly loaded and the outlet can be used as an entry point.
Does this PR introduce a breaking change?
Other information