You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ x ] Bug report
[ ] Feature request
[ ] Documentation issue or request
What is the current behavior?
'forFeature' part of the Store is being used in the 'forFeature' @effects (by combining Action with withLatestFrom(this.store.select(getFeatureState))) however the store at that time hasn't been updated with feature part. It gets updated a bit later when @ngrx/store/update-reducers is triggered.
This happens when there are > 1 EffectsModule.forFeature modules.
Expected behavior:
I've tried to defer(() => {...}) the whole thing, but apparently Effects are subscribed to earlier than Store is patched with feature.
Minimal reproduction of the problem with instructions:
The text was updated successfully, but these errors were encountered:
alex-okrushko
changed the title
Issues accessing 'forFeature' part of the store from 'forFeature' Effects
Issues accessing 'forFeature' part of the store from 'forFeature' @Effects when there are multiple EffectsModule.forFeature in the app
Dec 11, 2017
I'm submitting a...
What is the current behavior?
'forFeature' part of the Store is being used in the 'forFeature' @effects (by combining Action with
withLatestFrom(this.store.select(getFeatureState))
) however the store at that time hasn't been updated with feature part. It gets updated a bit later when@ngrx/store/update-reducers
is triggered.This happens when there are > 1 EffectsModule.forFeature modules.
Expected behavior:
I've tried to
defer(() => {...})
the whole thing, but apparently Effects are subscribed to earlier than Store is patched with feature.Minimal reproduction of the problem with instructions:
Here is my repro: https://stackblitz.com/edit/store-forfeature-issue?embed=1&file=app/app.module.ts
Important parts:
OtherFeatureModule
is imported beforeFeatureModule
in theAppModule
.OtherFeatureModule
hasEffectsModule.forFeature([...])
FeatureModule
hasEffectsModule.forFeature([...])
andStoreModule.forFeature({...})
@Effect()
that is part ofFeatureModule
usesthis.store.select(selectorThatUsesFeaturePartOfTheStore)
workarounds:
this.store.select(selectorThatUsesFeaturePartOfTheStore)
and only usethis.store.select(selectorThatUsesRootPartOfTheStore)
this.store.select(selectorThatUsesFeaturePartOfTheStore)
into the payload of the ActionNone of the workarounds look particular appealing to me.
Thank you @brandonroberts for debugging it with me.
The text was updated successfully, but these errors were encountered: