I found a bug related to SSR and lazy loading of CMS Components.
The bug looks like flickering of CMS components which is loaded via importing standalone component. When I import the same component via featureModules lazy loading it does not flicker.
I suppose the flickering is happening because SSR renders lazy component on the backend and later on the browser it is recreated but there is a time when the slot is cleared and import of lazy component is just scheduled so it didn't fetched yet. The featureModules resolves modules and cms components a lot earlier, I think at guard lvl.
LoginLogoutComponent: {
component: () =>
import('@app/shared/features/auth/components/login-logout/login-logout.component').then(
(m) => m.LoginLogoutComponent,
),
},
vs
// config
featureModules: {
LoginLogoutModule: {
cmsComponents: ['LoginLogoutComponent'],
module: () =>
import('@app/shared/features/auth/components/login-logout/login-logout.module').then(
(m) => m.LoginLogoutModule,
),
},
},
// other file
@NgModule({
imports: [LoginLogoutComponent],
providers: [
provideConfig({
cmsComponents: {
LoginLogoutComponent: {
component: LoginLogoutComponent,
},
},
}),
],
})
export class LoginLogoutModule {}
I found a bug related to SSR and lazy loading of CMS Components.
The bug looks like flickering of CMS components which is loaded via importing standalone component. When I import the same component via featureModules lazy loading it does not flicker.
I suppose the flickering is happening because SSR renders lazy component on the backend and later on the browser it is recreated but there is a time when the slot is cleared and import of lazy component is just scheduled so it didn't fetched yet. The featureModules resolves modules and cms components a lot earlier, I think at guard lvl.
vs