-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementing OnInitEffects with functionalEffects #4128
Comments
This isn't supported. |
We have one file with (functional) effects:
export const updateUrl = createEffect(
...
, { functional: true })
export const doFoo = createEffect(
...
, { functional: true })
export const getBar = createEffect(
...
, { functional: true }) We use them in our import * as Effects from '../effects';
@NgModule({
imports: [
EffectsModule.forFeature(Effects),
],
})
export class FeatureModule {} We would like to place the new initial effect in export class LoadVacanciesEffects implements OnInitEffects {
ngrxOnInitEffects(): Action {
return ListActions.PageEntered();
}
} However this does not work, since the |
I do find it weird to add a lifecycle to the functional effects. provideEffects(myEffects, { dispatchOnInit: myEffectsLoaded() }) |
That would help, but not the same. The cool thing about the OnInitEffect is that it only runs once, no matter how often it is provided in features. It was perfect for loading data for a feature for me. But we can always go back to using a |
Which @ngrx/* package(s) are relevant/related to the feature request?
effects
Information
Is it possible to use
createEffect
to implement theOnInitEffects
interface to trigger initial effects?Describe any alternatives/workarounds you're currently using
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: