[ANMS UI] Use Lazy Loading
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 2
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 2
Description
Copied from https://github.com/NASA-AMMOS/anms/issues/358#issuecomment-4838030066
To speed up page loading we can implement lazy loading in the app routes, following the Angular docs: https://v17.angular.io/guide/lazy-loading-ngmodules
For example, in https://github.com/NASA-AMMOS/anms/blob/37d95336837b17f3f93ad82c40070565bb019436/anms-ui/src/app/app.routes.ts#L14-L30
All the children would change from:
{
path: 'home',
component: DashboardHome
},
to
{ path: 'home', loadChildren: () => import('./features/dashboard/dashboard-home.routes').then(m => m.DashboardHomeRoutes) }
And you would have a new file './features/dashboard/dashboard-home.routes' that would contain:
export const DashboardHomeRoutes: Routes = [
{
path: 'home',
component: DashboardHome,
}
];
This makes it so the child components are not loaded in when navigating to the home page, and are only loaded in when navigating to them. I have a rudimentary patch I can provide as a starting point and we should be able to see how much it reduces initial bundle sizes during ng build.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with anms-ui/src/app/app.routes.ts and compare its child routes with the Angular lazy-loading guide linked in the issue. Review the existing feature route structure and run ng build to establish the initial bundle sizes. Done means the child routes use lazy loading, their route definitions are placed in the proposed feature route files, and the build shows the resulting bundle sizes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- frontend, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100