SchweizerischeBundesbahnen/scion-workbench

Workbench ignores view-specific route data associated with child routes of component-less routes

danielwiehl opened this issue · 0 comments

Describe the bug

The Workbench ignores view-specific data associated with a route that is a child of a component-less route.

To Reproduce

  1. Declare a component-less route in app-routing.module.ts, as follows:

    const routes = [
      {
        path: 'features',
        children: [
          {
            path: 'feature-a',
            component: FeatureAComponent,
            data: {
              [WorkbenchRouteData.title]: 'Feature A Title',
              [WorkbenchRouteData.heading]: 'Feature A Heading', 
              [WorkbenchRouteData.cssClass]: 'e2e-feature-a',
            }
          }
        ]
      },
    ];
  2. See that view-specific data (title, header, CSS class) is not set by the workbench.

Expected behavior

The workbench should support the following route definitions:

app-routing.module.ts

const routes = [
  {
    path: 'features',
    children: [
      {
        path: 'feature-a',
        component: FeatureAComponent,
        data: {
          [WorkbenchRouteData.title]: 'Feature A Title',
          [WorkbenchRouteData.heading]: 'Feature A Heading',
          [WorkbenchRouteData.cssClass]: 'e2e-feature-a',
        },
      },
    ],
  },
  {
    path: 'features-lazy',
    loadChildren: (): any => import('./features/features-routing.module').then(m => m.FeaturesRoutingModule),
  },
];

features-routing.module.ts

const routes = [
  {
    path: 'feature-a',
    component: FeatureAComponent,
    data: {
      [WorkbenchRouteData.title]: 'Feature A',
      [WorkbenchRouteData.heading]: 'Feature A',
      [WorkbenchRouteData.cssClass]: 'e2e-feature-a',
    },
  },
  {
    path: 'feature-b',
    loadComponent: (): any => import('./feature-b/feature-b.component').then(m => m.FeatureBComponent),
    data: {
      [WorkbenchRouteData.title]: 'Feature B',
      [WorkbenchRouteData.heading]: 'Feature B',
      [WorkbenchRouteData.cssClass]: 'e2e-feature-b',
    },
  },
];

Environment

  • SCION Workbench version: 14.0.0-beta.1
  • Angular version: 14.x