I am using Angular 7 with Ngrx and Rxjs 6. I got 2 lazy loaded modules A and B which have their own selectors and reducers.
Now, I would like to access the data stored on the module B state from the module A. The problem is that all of the ngrx components of module B get initialized only when the user navigates to the lazy loaded route of B, so if the user first goes to A , attempting to select the state will result in undefined errors because B is not yet initialized.
What would be the best practice in accessing the state of a lazy loaded module in this case?
In my opinion his use case is valid and ngrx ought to be able to handle it but it drops state if a reducer is not added to ngrx through the forFeature function because a lazy loaded module is not yet loaded which makes it impossible to retrieve the entire state from a database in the backend and use it as needed in lazy loaded modules.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With