Open skunkdome opened 1 year ago
I found the cause of the problem and a possible workaround.
Pages data is refreshed on language change only when the route has a cmsRequired
property set to true. And that property is true when a given route has a CmsPageGuard
(link to the code). The problem is that login route has a LoginGuard
which uses CmsPageGuard
internally but this is not detected by the router.reducer
.
router.reducer
so that it also checks for LoginGuard
. This is the simplest one but I'm afraid that this bug will reappear with some other guard some day.LoginRouteModule
and LoginGuard
so that LoginGuard
doesn't use CmsPageGuard
and CmsPageGuard
is listed explicitly in canActivate
.cmsRequired
property. Perhaps based on the routing config? @NgModule({
imports: [
PageLayoutModule,
RouterModule.forChild([
{
// @ts-ignore
path: null,
canActivate: [LoginGuard, CmsPageGuard],
component: PageLayoutComponent,
data: { cxRoute: 'login' },
},
]),
],
})
export class CustomLoginRouteModule {}
This is not ideal because CmsPageGuard
will be called twice but at least fixes the problem.
Describe the bug No 'pages' occ call when changing the language on the login page
Tell us the version of Spartacus
To Reproduce Steps to reproduce the behavior:
Expected behavior Would expect a OCC 'pages' request
Screenshots