In my @nx/angular standalone application, I'm utilizing all logical components as lazy-loaded separate libraries. The way providing my libs in app.routes.ts
Initially, the Pokémon library is loaded in the first run, where all NgRx structures such as effects and features are provided as shown below in lib.routes.ts: :
Providing EnvironmentProviders in lib.route.ts:
However, for the lazy-loaded Deck library, I couldn't provide EnvironmentProviders
in its lib.routes.ts
:
The solution I came up with, albeit somewhat forced, is depicted here:
Initially, Pokemon lib is loaded.
To add selected Pokémon to the deck state in PokéLibs, I'm dispatching an action meant to trigger an effect in the Deck library, which hasn't loaded yet. However, the Deck library is also lazy-loaded, so the app doesn't even know the states because the Deck library hasn't loaded yet...
I solved the problem in a somewhat forced manner by providing an NGRX structure at the app level, even though the Deck library is lazy-loaded. :(