diff --git a/apps/daffio/src/app/app.module.ts b/apps/daffio/src/app/app.module.ts index 104815c969..8502e5b7c8 100644 --- a/apps/daffio/src/app/app.module.ts +++ b/apps/daffio/src/app/app.module.ts @@ -18,7 +18,10 @@ import { StoreModule } from '@ngrx/store'; import { StoreDevtoolsModule } from '@ngrx/store-devtools'; import { DAFF_THEME_INITIALIZER } from '@daffodil/design'; -import { provideDaffRouterActivatedRoute } from '@daffodil/router'; +import { + provideDaffRouterActivatedRoute, + provideDaffRouterDataServiceConfig, +} from '@daffodil/router'; import { provideDaffSeoRouterSchema } from '@daffodil/seo/router'; import { AppRoutingModule } from './app-routing.module'; @@ -26,45 +29,53 @@ import { DaffioAppComponent } from './app.component'; import { environment } from '../environments/environment'; import { DaffioMarketingFooterComponentModule } from './core/footer/marketing-footer/marketing-footer.module'; import { DaffioSimpleFooterComponentModule } from './core/footer/simple-footer/simple-footer.module'; +import { daffioRouterDataServiceConfig } from './core/router/data-service-config'; import { DaffioSidebarFooterComponentModule } from './core/sidebar/components/sidebar-footer/sidebar-footer.module'; import { DaffioSidebarHeaderComponentModule } from './core/sidebar/components/sidebar-header/sidebar-header.module'; import { TemplateModule } from './core/template/template.module'; -@NgModule({ declarations: [ - DaffioAppComponent, -], -bootstrap: [ - DaffioAppComponent, -], imports: [BrowserModule, - BrowserAnimationsModule, - StoreModule.forRoot({}), - EffectsModule.forRoot(), - AppRoutingModule, - DaffioSidebarHeaderComponentModule, - DaffioSidebarFooterComponentModule, - DaffioSimpleFooterComponentModule, - DaffioMarketingFooterComponentModule, - //Make sure this loads after Router and Store - StoreRouterConnectingModule.forRoot({ serializer: FullRouterStateSerializer, +@NgModule({ + declarations: [ + DaffioAppComponent, + ], + bootstrap: [ + DaffioAppComponent, + ], + imports: [ + BrowserModule, + BrowserAnimationsModule, + StoreModule.forRoot({}), + EffectsModule.forRoot(), + AppRoutingModule, + DaffioSidebarHeaderComponentModule, + DaffioSidebarFooterComponentModule, + DaffioSimpleFooterComponentModule, + DaffioMarketingFooterComponentModule, + //Make sure this loads after Router and Store + StoreRouterConnectingModule.forRoot({ serializer: FullRouterStateSerializer, /* They stateKey defines the name of the state used by the router-store reducer. This matches the key defined in the map of reducers */ - stateKey: 'router' }), - StoreDevtoolsModule.instrument({ - maxAge: 25, // Retains last 25 states - logOnly: environment.production, // Restrict extension to log-only mode - connectInZone: true, - }), - TemplateModule, - ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production })], providers: [ - DAFF_THEME_INITIALIZER, - { - provide: APP_ID, - useValue: 'serverApp', - }, - provideDaffRouterActivatedRoute(), - provideDaffSeoRouterSchema(), - provideHttpClient(withInterceptorsFromDi()), -] }) + stateKey: 'router' }), + StoreDevtoolsModule.instrument({ + maxAge: 25, // Retains last 25 states + logOnly: environment.production, // Restrict extension to log-only mode + connectInZone: true, + }), + TemplateModule, + ServiceWorkerModule.register('ngsw-worker.js', { enabled: environment.production }), + ], + providers: [ + DAFF_THEME_INITIALIZER, + { + provide: APP_ID, + useValue: 'serverApp', + }, + provideDaffRouterActivatedRoute(), + provideDaffSeoRouterSchema(), + provideHttpClient(withInterceptorsFromDi()), + provideDaffRouterDataServiceConfig(daffioRouterDataServiceConfig), + ], +}) export class AppModule {} diff --git a/apps/daffio/src/app/core/router/data-service-config.ts b/apps/daffio/src/app/core/router/data-service-config.ts new file mode 100644 index 0000000000..7aa382595c --- /dev/null +++ b/apps/daffio/src/app/core/router/data-service-config.ts @@ -0,0 +1,10 @@ +import { daffDictAssignMerger } from '@daffodil/core'; +import { DaffRouterDataServiceConfig } from '@daffodil/router'; + +import { DaffioRoute } from './route.type'; + +export const daffioRouterDataServiceConfig: DaffRouterDataServiceConfig = { + mergeStrategy: { + daffioSidebars: daffDictAssignMerger, + }, +};