router-component-store icon indicating copy to clipboard operation
router-component-store copied to clipboard

Add support for NavigationExtras state

Open fleish80 opened this issue 1 year ago • 5 comments

Support for NavigationExtras state is missing. For a example this.router.navigate(['/some-path'], {state: {some-state-key : 'some-state-value'}}, should add to #serializeRouteSnapshot a property something like {navigationState: {some-state-key : 'some-state-value'}}.

fleish80 avatar Dec 25 '22 11:12 fleish80

Thank you for your syggestion, @fleish80. The serializer is mostly based on that of NgRx Router Store, meaning this feature must not be supported by that library. I would be interested to learn about discussions of a similar proposal for NgRx Router Store.

LayZeeDK avatar Dec 25 '22 14:12 LayZeeDK

I'm currently working on the RouterHistoryStore. Seems like this feature request could be more related to that than to the RouterStore.

@fleish80, please send use cases for router state usage.

LayZeeDK avatar Dec 25 '22 14:12 LayZeeDK

The router state isn't part of ActivatedRouteSnapshot so it's not available to the route serializer.

LayZeeDK avatar Dec 25 '22 14:12 LayZeeDK

Thank you for your syggestion, @fleish80. The serializer is mostly based on that of NgRx Router Store, meaning this feature must not be supported by that library. I would be interested to learn about discussions of a similar proposal for NgRx Router Store.

In the Ngrx Router Store, it's possible to use your own custom serializer, and it's possible there to inject anything You want, and thus you can, for example, to inject the Router, from which you can extract the NavigationExtras. This could be the solution.

fleish80 avatar Dec 29 '22 08:12 fleish80

Related to https://github.com/ngworker/router-component-store/issues/260.

LayZeeDK avatar Jan 01 '23 23:01 LayZeeDK