You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed degrade performance when refactoring my application to use the new Angular standalone components and routing when using ngx-quicklink so decided to investigate.
It turns out that if you have nested routes, ngx-quicklink incorrectly returns false for shouldPrefetch for these nested routes, as they were never correctly registered. The current implementation of ngx-quicklinkrelies on an internal property_loadedRoutes which is not available at runtime for standalone routing. Since current will always be an empty array, the for loop below never runs and more importantly, the children.forEach() doesn't run. This in turn is the cause of the routes not registering correctly: children is properly populated, but as the forEach is inside of a loop that never runs, the parent map never gets populated and as such findPath returns an invalid result, leading to those nested routes not prereloading correctly.
I've submitted a PR #151 to address the issue. It also updates the standalone example with the scenario I described above, using a SubComponent to recreate the nested routing. You can run the example and take a look at the network tab with and without my fix to verify both the behaviour being broken before, and fixed after.
The text was updated successfully, but these errors were encountered:
I noticed degrade performance when refactoring my application to use the new Angular standalone components and routing when using
ngx-quicklink
so decided to investigate.It turns out that if you have nested routes,
ngx-quicklink
incorrectly returnsfalse
forshouldPrefetch
for these nested routes, as they were never correctly registered. The current implementation ofngx-quicklink
relies on an internal property_loadedRoutes
which is not available at runtime for standalone routing. Sincecurrent
will always be an empty array, thefor
loop below never runs and more importantly, thechildren.forEach()
doesn't run. This in turn is the cause of the routes not registering correctly:children
is properly populated, but as theforEach
is inside of a loop that never runs, theparent
map never gets populated and as suchfindPath
returns an invalid result, leading to those nested routes not prereloading correctly.I've submitted a PR #151 to address the issue. It also updates the standalone example with the scenario I described above, using a
SubComponent
to recreate the nested routing. You can run the example and take a look at the network tab with and without my fix to verify both the behaviour being broken before, and fixed after.The text was updated successfully, but these errors were encountered: