platform icon indicating copy to clipboard operation
platform copied to clipboard

Router state is not serializable when custom title Resolver is used

Open markostanimirovic opened this issue 3 years ago • 0 comments

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

markostanimirovic avatar Jul 17 '22 20:07 markostanimirovic