Skip to content

Commit

Permalink
fix(Effects): Ensure StoreModule is loaded before effects (#230)
Browse files Browse the repository at this point in the history
Closes #184, #219
  • Loading branch information
brandonroberts authored and MikeRyanDev committed Aug 3, 2017
1 parent f969676 commit 065d33e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions modules/effects/src/effects_feature_module.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { NgModule, Inject, Type } from '@angular/core';
import { NgModule, Inject, Optional } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { EffectsRootModule } from './effects_root_module';
import { FEATURE_EFFECTS } from './tokens';

@NgModule({})
export class EffectsFeatureModule {
constructor(
private root: EffectsRootModule,
@Inject(FEATURE_EFFECTS) effectSourceGroups: any[][]
@Inject(FEATURE_EFFECTS) effectSourceGroups: any[][],
@Optional() storeModule: StoreModule
) {
effectSourceGroups.forEach(group =>
group.forEach(effectSourceInstance =>
Expand Down
6 changes: 4 additions & 2 deletions modules/effects/src/effects_root_module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NgModule, Inject } from '@angular/core';
import { NgModule, Inject, Optional } from '@angular/core';
import { StoreModule } from '@ngrx/store';
import { EffectsRunner } from './effects_runner';
import { EffectSources } from './effect_sources';
import { ROOT_EFFECTS } from './tokens';
Expand All @@ -8,7 +9,8 @@ export class EffectsRootModule {
constructor(
private sources: EffectSources,
runner: EffectsRunner,
@Inject(ROOT_EFFECTS) rootEffects: any[]
@Inject(ROOT_EFFECTS) rootEffects: any[],
@Optional() storeModule: StoreModule
) {
runner.start();

Expand Down

0 comments on commit 065d33e

Please sign in to comment.