My question is quite similar to this one : Angular 7, Ngrx, Rxjs 6 - Accessing state between lazy loaded modules
Having an angular root module (AppModule) that wants to be notified if an action occurred in a lazy-loaded submodule (an AuthModule that dispatch a CONNECTED action), so that it can update its own shell ui (hiding some nav actions...)
How can AppModule reducer have access to actions and selectors declared in AuthModule, since there shouldn't be a static dependency between these both modules ? (lazy-loading)
Since NgRx encourages using createFeature
that declares reducers and selectors in a single file of a submodule, there should be a way for the parent module to reference those actions.
The only way I see so far, is by creating a third module, that store auth actions, reducer and selectors, and reference it from both AppModule and AuthModule. But this might create a bunch of new modules just for some technical reasons..
Do you know a better setup ?