DataPersistence navigation run method is not triggered when using RouterState.Minimal
See original GitHub issueExpected Behavior
I am not sure about what the expected behaviour should be regarding the effect, since I understand that the navigation logic requires access to the routed component in order to match it and fire the run trigger. However, some documentation warning us that this combination is not compatible or some kind of runtime checks (if that were possible) instead of silently ignoring the effect would be nice.
Current Behavior
When trying to use a navigation effect, the run block only gets fired if the RouterState serialization strategy is not Minimal. The reason for this is that the findSnapshot function requires access to the routed Component, which is not included when using the RouterState.Minimal serializer. As far as I understand, this serializer is useful for having fully serializable actions, which the default serializer doesn’t provide.
Context
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 8.1.0-beta.2
Node: 10.15.0
OS: win32 x64
Angular: 8.1.0-next.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.801.0-beta.2
@angular-devkit/build-angular 0.801.0-beta.2
@angular-devkit/build-optimizer 0.801.0-beta.2
@angular-devkit/build-webpack 0.801.0-beta.2
@angular-devkit/core 8.1.0-beta.2
@angular-devkit/schematics 8.1.0-beta.2
@angular/cdk 8.0.1
@angular/cli 8.1.0-beta.2
@angular/flex-layout 8.0.0-beta.26
@angular/http 8.0.0-beta.10+1.sha-a28b3e3
@angular/material 8.0.1
@ngtools/webpack 8.1.0-beta.2
@schematics/angular 8.0.1
@schematics/update 0.801.0-beta.2
rxjs 6.4.0
typescript 3.4.5
webpack 4.34.0
Ngrx related packages version:
"@ngrx/store": "^8.0.1",
"@ngrx/effects": "^8.0.1",
"@ngrx/entity": "^8.0.1",
"@ngrx/router-store": "^8.0.1",
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7 (5 by maintainers)
We have fixed this upstream in NgRx so that you can use the serialization/immutability checks with the full router state, so these workarounds aren’t needed. See https://github.com/ngrx/platform/pull/2491 and https://github.com/ngrx/platform/pull/2351 for context
Alternatively, would you accept PR that makes DataPersistence navigation method able to work based only on the routed component name, alongiside a custom router state serializer for this purpose?