platform icon indicating copy to clipboard operation
platform copied to clipboard

`navigationTrigger` missing from event on `routerRequestAction`

Open TyrantWave opened this issue 2 years ago • 1 comments

Which @ngrx/* package(s) are the source of the bug?

router-store

Minimal reproduction of the bug/regression with instructions

The router action type routerRequestAction should an event of type NavigationStart, however it's the wrong type, as such navigationTrigger is missing.

StackBlitz: https://stackblitz.com/edit/ngrx-router-request-event-type-mismatch?file=src%2Fapp%2Feffects%2Fcounter.effects.ts,src%2Fapp%2Fapp.module.ts

The router request action is logged when fired, with the following body for event:

{
  id: 1,
  url: "/",
  urlAfterRedirects: undefined
}

Minimal reproduction of the bug/regression with instructions

Expected behaviour is that the event attr is of type NavigationStart

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

Local: NgRX: 14.0.2 Anguar: 14.2.2 Node: v19.9.0 Chrome: Version 114.0.5735.198 (Official Build) (x86_64) MacOS: 13.4.1 (c) (22F770820d)

StackBlitz: NgRx: 13.0.2 Angular: 13.1.1

Other information

No response

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

  • [ ] Yes
  • [X] No

TyrantWave avatar Jul 14 '23 13:07 TyrantWave

When you want to receive the Angular router event, you can configure the router store to dispatch the full event. The reason why this config exists is due to the runtime checks, because the event instance violates these checks.

    StoreRouterConnectingModule.forRoot({
      routerState: RouterState.Full
    }),

Maybe that these types need to be updated though.

timdeschryver avatar Jul 28 '23 11:07 timdeschryver