colinskow / angular-electron-dream-starter

:tada: An Angular Electron Starter kit featuring Webpack, Angular 4 (Router, Http, Forms, Services, ngrx, Tests, E2E, Coverage), Karma, Spectron, Jasmine, Istanbul, and TypeScript
MIT License
162 stars 54 forks source link

Preloading Strategy & Lazy Loaded Modules #21

Open Kaffiend opened 6 years ago

Kaffiend commented 6 years ago

[ *] question about the decisions made in the repository

Please refer to this question on NGRX

colinskow commented 6 years ago

This behavior comes from the upstream repository that I forked. I had nothing to do with it.

What's happening is it bootstraps the root module, and then waits for the browser idle event. When the browser is idle it loads all the additional modules in the background. This has the advantage that when the user navigates to a lazy-loaded module it will be pre-loaded, but without delaying the overall start time of the application.

Kaffiend commented 6 years ago

Right, I understand that and agree to the advantages, but should there be some explanation perhaps in a comment above the router configuration for less experienced seed users? It could be misleading seeing a lazy loaded module's state in the dev tools when they haven't actually called that module yet. I'm speaking strictly from a state management point of view obviously, and there comes a point in larger scale applications when full asynchronous state is more of a requirement...or luxury.

Edit: Please don't misunderstand me, i'm not trying to nit pick. These are just things i notice having a team comprised of different skill levels in the same stack. Things i find, helpful and time saving as things progress.

colinskow commented 6 years ago

Yeah, I had a discussion a while ago with the folks from AngularClass because I thought it was a bug all the modules where loading at once. PR welcome to explain this in the documentation.

Kaffiend commented 6 years ago

Absolutely, not a problem.