perf(startup): remove blocking components loader wait; defer component instantiation until navigation; trigger initial cluster load immediately

This commit is contained in:
2025-08-31 14:27:33 +02:00
parent 8b0267ea2a
commit ac6c2fbb80
3 changed files with 19 additions and 19 deletions

View File

@@ -635,8 +635,8 @@ class App {
registerRoute(name, componentClass, containerId, viewModel = null) {
this.routes.set(name, { componentClass, containerId, viewModel });
// Pre-initialize component in cache for better performance
this.preInitializeComponent(name, componentClass, containerId, viewModel);
// Defer instantiation until navigation to reduce startup work
// this.preInitializeComponent(name, componentClass, containerId, viewModel);
}
// Pre-initialize component in cache
@@ -771,7 +771,15 @@ class App {
async showView(routeName, component) {
const container = component.container;
// Ensure component is mounted (but not necessarily active)
// Ensure component is mounted (but not necessarily active); lazy-create now if needed
if (!component) {
const route = this.routes.get(routeName);
const container = document.getElementById(route.containerId);
component = new route.componentClass(container, route.viewModel, this.eventBus);
component.routeName = routeName;
component.isCached = true;
this.componentCache.set(routeName, component);
}
if (!component.isMounted) {
logger.debug(`App: Mounting component for '${routeName}'`);
component.mount();