Skip to content

Router state is not serializable when custom title Resolver is used #3495

@markostanimirovic

Description

@markostanimirovic

Minimal reproduction of the bug/regression with instructions

If a route uses custom title Resolver:

@Injectable({
  providedIn: 'root',
})
class TestResolver implements Resolve<string> {
  resolve(): string {
    return 'Test Title';
  }
}

const routes: Routes = [
  {
    path: 'test',
    component: TestComponent,
    title: TestResolver,
  },
];

The router state won't be serializable because the value of routeConfig.title will be TestResolver class.

Minimal reproduction of the bug/regression with instructions

The value of the routeConfig.title property should be resolved title.

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

NgRx ^14.0.0
Angular ^14.0.0

Other information

When resolved, the route title will be part of the route.data object, but its key is a symbol (Symbol('RouteTitle')) that is not part of the public API.

I would be willing to submit a PR to fix this issue

  • Yes
  • No

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions